脚本宝典收集整理的这篇文章主要介绍了php – Google测量协议返回GIF89a ,D;,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在使用HTTP post请求发送数据.
$url = 'http://www.google-Analytics.COM/collect'; $fields_string = ''; $fields = array( 'v' => 1,'tid' => 'UA-xxxxxxx-xx','cid' => xxx,'t' => 'event','ec' => 'category','ea' => 'imPression','el' => 'label' ); foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); $result = curl_exec($ch); curl_close($ch);
$result = curl_exec($ch);
因为你没有“告诉”卷曲,否则它只会将返回溢出到浏览器.
所以最后,你卷曲部分应该像这样:
$ch = curl_inIT(); curl_setopt($ch,$url); //curl the url curl_setopt($ch,$fields_string); curl_setopt($ch,CURLOPT_RETURNtransfer,TRUE); //return the transfer to be later saved to a VARiable $result = curl_exec($ch);
以上是脚本宝典为你收集整理的php – Google测量协议返回GIF89a ,D;全部内容,希望文章能够帮你解决php – Google测量协议返回GIF89a ,D;所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。