无法让这个内容旋转API与PHP一起使用

时间:2011-09-23 18:44:04

标签: php api spinner

你能帮助我content spinning API工作吗?它是用C#编写的,但有没有办法可以让它使用PHP工作?我一直在尝试使用cURL发布到该页面上显示的URL,但我要回来的只是一个空白页面。这是我正在使用的代码:

$url = "http://api.spinnerchief.com/apikey=YourAPIKey&username=YourUsername&password=YourPassword";

// Some content to POST
$post_fields = "SpinnerChief is totally free. Not a 'lite' or 'trial' version, but a 100% full version and totally free. SpinnerChief may be free, but it is also one of the most powerful content creation software tools available. It's huge user-defined thesaurus means that its sysnonyms are words that YOU would normally use in real life, not some stuffy dictionary definition. And there's more...SpinnerChief can only get better, because we listen to our users, We take onboard your ideas and suggestions, and we update SpinnerChief so that it becomes the software YOU want!";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PORT, 9001);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);

echo $result;

任何人都可以看到我在做错事吗?非常感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

CURLOPT_POST的值应为1,发布的数据应设为CURLOPT_POSTFIELDS