cURL / wp_remote_post: won't work in wordpress plugin


Staff member
I'm working on a wordpress plugin, which pull data from another site via a cURL post call. I've tested the same code in i wordpress plugin and outsite of wordpress.

Outsite of wordpress the script works fine, but inside a wordpress plugin, the script just wont work:

Wordpress plugin:

$handle = curl_init();
curl_setopt($handle, CURLOPT_URL,             $url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER,  true);
curl_setopt($handle, CURLOPT_POST,            true );
curl_setopt($handle, CURLOPT_FOLLOWLOCATION,  true );
curl_setopt($handle, CURLOPT_POSTFIELDS,      array('postfield' => 'postfieldcontent'));

$result = curl_exec($handle);

Main site:

mysql_query("INSERT INTO table (q, w, e, r, t, y, u) VALUES ('', '".$_POST[postfield]."', '', '', '', '', '')");

I've removed all database security for debugging purpose. I have also tried the wp_remote_post function, that doesn't work either. I've even triede the the wp_remote_get function, but i can access the get variable:

$result = wp_remote_get( '' );

I've given up - please help :)

Best regards