Deprecated: Function set_magic_quotes_runtime() is deprecated in /nfs/c01/h08/mnt/2939/domains/cidamon.com/html/blog/textpattern/lib/txplib_db.php on line 14
Cidamon: Blog: Simple use of CURL
Simple use of CURL
05 January, 2009

Here is a very simple structure of how to use curl with post method –


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://example.com/target.php');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);	
curl_setopt($ch, CURLOPT_POST , 1);// setting up to use post method
curl_setopt($ch, CURLOPT_POSTFIELDS, array("fieldName1"=>"data1","fieldName2"=>"data2"));							
$content = curl_exec($ch);
curl_close($ch);

---

Commenting is closed for this article.