开发者

Page views using curl PHP

开发者 https://www.devze.com 2023-02-22 20:22 出处:网络
I am trying visit a blog using curl and my understanding about curl is that it would increase the page views. I am using stat counter on the same blog to capture visitor statistics, but I don\'t see a

I am trying visit a blog using curl and my understanding about curl is that it would increase the page views. I am using stat counter on the same blog to capture visitor statistics, but I don't see any increase after using the curl script several times. `

<?php
$site="http://forex-eguide.blogspot.com";
curl_setopt($curl, CURLOPT_URL, $site);
curl_setopt($curl, CURLOPT_COOKIEJAR, $ckfile); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);

$return=curl_exec($curl);

curl_close($curl);
?>

`

what am I doing wrong here or am I missing anything or is my understanding incorrect...

I am running 开发者_运维知识库the php on my windows xp and apache 2.2.x


Try to pose as a browser by setting the agent.

curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13')


AFAIK, cURL will only get you the HTML as plain text. So if your tracker for example uses a script, this script would first of all have to be downloaded in addition to the webpage you fetched. Secondly the JavaScript will have to be interpreted and run (like a browser do). Don't think cURL does this. Same if it uses a tiny picture. This picture would have to be downloaded too, but don't think cURL does this automatically. It just grabs the plain HTML.

If the stat tracking happens server side, as part of the request that results in the HTML you get back, then it should work to just "touch" it with cURL.

0

精彩评论

暂无评论...
验证码 换一张
取 消