2014-02-10 47 views

回答

5

您發佈的解決方案使用套接字,這隻有在啓用了計費功能後才能起作用(請參閱https://developers.google.com/appengine/docs/php/sockets/)。

或者,您可以使用file_get_contents和流上下文(https://developers.google.com/appengine/docs/php/urlfetch/)中設置的「授權」標頭,例如,

$context = 
array("http"=> 
    array(
    "method" => "post", 
    "header" => "Authorization: Basic " . base64_encode($username.':'.$password) . "\r\n", 
    "content" => $data 
) 
); 
$context = stream_context_create($context); 
$result = file_get_contents(url, false, $context); 
+0

這也適用於https請求嗎? – Akhilesh

+0

獲取以下錯誤:HTTP/1.1 400錯誤請求,純文本發送到https – Akhilesh

+0

具體而言,我想發送類似於此處提到的請求http://dev.cloudup.com/#items-create-url – Akhilesh

相關問題