Jump to content

PHP curl post


imperium2335

Recommended Posts

Hi, I have made the following script to post a comment to a wordpress blog, but it is not posting the comment nor echoing any result:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "wp-comments-post.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "author=Phil&[email protected]&url=popopop&comment=this is phillip");
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_REFERER, $currenturl);
$z = rand(0, 4) ;
curl_setopt($ch, CURLOPT_USERAGENT, $agents[$z]);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1) ;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1) ;

$result = curl_exec ($ch);
curl_close ($ch); 

echo $result;

 

Any ideas why it wont work? Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/177999-php-curl-post/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.