Wednesday, August 29, 2012

simple curl using php example

1- create post.php curl value paste below code
---------------------------------------------------------
$Curl_Session = curl_init('http://127.0.0.1/test/getvalue.php');
 curl_setopt ($Curl_Session, CURLOPT_POST, 1);
 curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "Name=hari");
 curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
 $ss=curl_exec ($Curl_Session);
 curl_close ($Curl_Session);
---------------------------------------------------
2-create getvalue.php value paste below code
---------------------------------------------------
if(isset($_REQUEST['Name'])){
 echo $_REQUEST['Name'];
}

No comments:

Post a Comment