通过PHP中的CURL获取Google Sites API – 获取“prolog中不允许使用内容”.

前端之家收集整理的这篇文章主要介绍了通过PHP中的CURL获取Google Sites API – 获取“prolog中不允许使用内容”.前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
$curl = new Curl();
$data = 'Email='.urlencode('MYEMAIL@EMAIL.COM').'&Passwd='.urlencode('MYPASSWORD').'&accountType=GOOGLE&source=Google-cURL-Example&service=jotspot';
$curl->post('https://www.google.com/accounts/ClientLogin',$data);

//match authorization token
preg_match("!Auth=(.*)!",$curl->response,$match);
$auth = $match[1];

//set curl headers
$curl->set_headers(array(
'Content-Type: application/atom+xml; charset=utf-8','Host: sites.google.com','GData-Version: 1.4','Authorization: GoogleLogin auth='. trim($auth)));

//get a list of sites associated with my domain
$curl->get('https://sites.google.com/Feeds/site/clevertechie.mygbiz.com'); 

//contains data returned by $curl->get();
echo $curl->response;

因此,我没有从$curl->响应中获取网站列表,而是收到一条消息 – “prolog中不允许使用内容”.我到处寻找并无法找到解决方案,请帮忙!谢谢! 原文链接:https://www.f2er.com/php/137096.html

猜你在找的PHP相关文章