2011-09-23 79 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

哦,是的。它返回「無法連接到主機」。 –