php 采集qq空间,php使用curl抓取qq空间的访客信息示例

这篇博客展示了config.php、qy.visitor.php和qy.class.php三段代码,涉及QQ采集间隔、会话记录文件、请求超时时间等配置,并在qy.visitor.php中使用了这些配置进行QQ访客信息获取和处理。代码中包含了多个登录用户的账号和密码,并提供了错误处理和调试功能。
摘要由CSDN通过智能技术生成

config.php

代码如下:

define('APP_DIR', dirname(__FILE__));

define('COOKIE_FILE', APP_DIR . '/app.cookie.txt'); //会话记录文件

define('VISITOR_CAPTURE_INTERVAL', 3); //QQ采集间隔

define('VISITOR_DATA_UPLOAD_INTERVAL', '');

define('THIS_TIME', time());

define('REQUEST_TIMEOUT', 20); //请求超时20秒

define('END_LINE', "n");

define('DEBUG', true); //开启调试

$login_users = array(

array('user' => '2064556526', 'password' => '909124951'),

array('user' => '483258700', 'password' => '909124951'),

array('user' => '1990270522', 'password' => '909124951'),

array('user' => '2718711637', 'password' => '909124951'),

array('user' => '2841076562', 'password' => '909124951'),

);

qy.visitor.php

代码如下:

include('./config.php');

include(APP_DIR . '/qy.visitor.php');

$sessions = array();

$user = $login_users[array_rand($login_users)];

$visitor_capture = new QQVisitorCapture($user['user'], $user['password'], COOKIE_FILE, REQUEST_TIMEOUT, DEBUG, END_LINE);

$visitors = $visitor_capture->getVisitorInfo();

if (empty($visitors)) {

$this->clearCookies(true);

} else {

$cckf_service = new CCKFService(SECURITY_KEY,SERVICE_ID,SERVICE_ADDRESS,'', REQUEST_TIMEOUT, DEBUG, END_LINE);

}

qy.class.php

代码如下:

class Trace

{

public static function nl($num = 1)

{

$str = '';

for ($i = 0; $i < $num; $i++) {

$str .= "n";

}

return $str;

}

public static function br($num = 1)

{

$str = '';

for ($i = 0; $i < $num; $i++) {

$str .= "
";

}

return $str;

}

public static function write($content, $end_line, $title = null)

{

$close = '^^^^^^^^^^^^^^^^^';

if ($title) {

$start = '--------' . $title . '---------';

} else {

$start = '-----------------';

}

echo $start . $end_line;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值