Upload File’s Data in Mysql Table

It was really a challenging task to upload any data (fixed pattern) from a file into Mysql table in Php. So I tried many queries and also search on forums as well, finally I got this:

$query=“LOAD DATA INFILE ‘”.$_SERVER[‘DOCUMENT_ROOT’].“/my_formatted_data_file.txt’ INTO TABLE my_db_table FIELDS TERMINATED BY ‘|’ IGNORE 1 LINES;”;


And it really works.

, ,

Leave a comment

Post XML on HTTPS using PHP CURL

Recently I was working on one of project. There I need to post some data to HTTPs server. I though for using CURL in php. But it was very tough to submit the XML in form of post. I had tried a lots of code from net, but none were success full. so I tried the below:

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: text/xml’));
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);

It was really very helpful and got the desired result.


Leave a comment

How to create a Plugin for Cpanel

You have to open the url http://www.cpanel.net/developer/overview.html and create an installer. Now follow the instruction as give in Document.

Leave a comment