Description :
cURL function with POST method
Function :
$target = ""; //for url target
$ref = "http://www.google.com/"; //for referral
$post = "name=john&email=johnsmith@example.com&address=usa"; //post content, sparate with &
$Curl_Session = curl_init($target);
curl_setopt ($Curl_Session, CURLOPT_POST, 1);
curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, "$post");
curl_setopt ($Curl_Session, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec ($Curl_Session);
curl_close ($Curl_Session);
Tidak ada komentar:
Posting Komentar