2011-09-23 26 views
-1

您能否帮助我获取此工作的content spinning API?它被写入与C#一起工作,但有没有一种方法可以使它使用PHP?我一直试图使用cURL发布到该页面上的URL,但是我回来的只是一个空白页面。下面是我使用的代码:无法使用此内容旋转API与PHP一起使用

$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; 

有人能看到什么不对我在干什么?非常感谢您的帮助。

+0

您是否用有效数据替换了YourAPIKey等? –

+0

是的:)它只是发回一个空白页。 –

+0

当您浏览到URL(完全绕过PHP脚本)时,您会得到什么?该网址是否有效? –

回答

1

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

+0

是的,也试过了。仍然没有返回。 :(如果发布正确,至少应该返回一个错误或者其他东西,但它不会。 –

+0

'curl_error'返回什么? –

+0

哦,是的。它返回“无法连接到主机”。 –

相关问题