<?php
/* 取自互联网: post访问网页, 参数: post地址 -> post数据 -> Cookie, 返回: 取出文本 */
function post ($str1,$str2,$cookie){
	$ch = curl_init();
	curl_setopt($ch,CURLOPT_URL,$str1);
	curl_setopt($ch,CURLOPT_HEADER,1);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie);
	curl_setopt($ch,CURLOPT_POST,1);
	curl_setopt($ch,CURLOPT_POSTFIELDS,$str2);
	$data = curl_exec($ch);
	curl_close($ch);
	return $data;
}
/* 取自互联网: 取出中间文本, 参数: 全文本 -> 文本, 返回: 取出文本 */
function text_midtext ($str,$left,$right){
	$a = explode($left,$str);
	$sz2 = $a[1];
	$sz1 = explode($right,$sz2);
	return $sz1[0];
}
require '../../Source/temp/Code.php';
$qq = '2389365961';
$data = post ('http://pt.3g.qq.com/jh/index.jsp','act=g&u='.$qq);
$imgu = text_midtext ($data,'<img src="','"');
$yzm = Code_get ($imgu,'ays88.com','打码密码');
$extend = text_midtext ($data,'name="extend" value="','" />');
$rsid = text_midtext ($data,'name="rsid" value="','" />');
$data = post ('http://pt.3g.qq.com/jh/index.jsp','u='.$qq.'&verCode='.$yzm.'&extend='.$extend.'&rsid='.$rsid.'&act=v');
if (strpos ($data,'号码激活受理成功') != false){
	echo '号码激活受理成功';
}else{
	echo '受理失败';
}
?>
