通过PHP中的CURL获取Google Sites API – 获取“prolog中不允许
发布时间:2020-12-13 13:21:47 所属栏目:PHP教程 来源:网络整理
导读:$curl = new Curl();$data = 'Email='.urlencode('MYEMAIL@EMAIL.COM').'Passwd='.urlencode('MYPASSWORD').'accountType=GOOGLEsource=Google-cURL-Exampleservice=jotspot';$curl-post('https://www.google.com/accounts/ClientLogin',$data);//match auth
$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中不允许使用内容”.我到处寻找并无法找到解决方案,请帮忙!谢谢! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |