Use curl for POST Method

You can securely send you from data to remote server using curl POST method.
For post method
$url ='http://yoursite.com';
$useragent= "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" ;
$data['name']='Krishna Bhattarai';
$data['address']='Samakhusi Kathmandu Nepal';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url); //set the url we want to use
curl_setopt($ch, CURLOPT_POST, 1); //set how many paramaters
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
$result=curl_exec ($ch); //execute and get the results
curl_close ($ch);

The result from remote site is stored in result variable($result).

Comments

Popular posts from this blog

Microsoft and Facebook Announce .NET Client Library

Use curl for GET Method