这是命令行:转换卷曲命令行PHP
curl --silent --header "Authorization: MyLogin auth=xxxxxxxxxxxxxxxxxxx" "https://www.myweb.com/"
我这是我(试过各种变化与头)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.myweb.com");
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Authorization: MyLogin','auth: xxxxxxxxxxxxxxxxxxx'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
我想我搞乱在头部分,任何帮助将不胜感激。谢谢。
添加*这就是我实际上
http://code.google.com/apis/gdata/articles/using_cURL.html#authenticating
我只是改写了它的工作,现在,它的作品,这是我所:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: GoogleLogin auth=$authCode"));
//curl_setopt($ch, CURLINFO_HEADER_OUT, true); // for debugging the request
//var_dump(curl_getinfo($ch,CURLINFO_HEADER_OUT)); //for debugging the request
$response = curl_exec($ch);
curl_close($ch);
echo $response;
是的,我已经试过这种方式,以及=而不是:,谢谢。我想我可能会调用错误的头部类型的调用,但我不知道还有什么其他用途。 – iamdamnsam