|
发表于 2015-10-12 09:56:08
|
显示全部楼层
湖北省武汉市
<?php
header("Content-Type:text/html;charset='UTF-8'");
class web_get{
public $url;
public $method=0;
public $postdata;
public $cookie;
public $return_cooke;
public $refer='';
public $outtime=60;
public $https=false;
private $ch;
public function __construct(){
define('_LOCAL_DIR', dirname(__FILE__).'/tmp');
if(!is_dir(_LOCAL_DIR)){
mkdir(_LOCAL_DIR);
}
define('_LOCAL_COOKIE_path', tempnam(_LOCAL_DIR,'cookie'));
$this->ch=curl_init();
}
public function __destruct(){
curl_close($this->ch);
}
public function _getweb(){
curl_setopt($this->ch,CURLOPT_URL,$this->url);
//curl_setopt($this->ch,CURLOPT_HEADER,1);//启用时会将头文件的信息作为数据流输出,可以看见文件头信息
curl_setopt($this->ch,CURLOPT_REFERER,$this->refer);
curl_setopt($this->ch,CURLOPT_TIMEOUT,$this->time);
curl_setopt($this->ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($this->ch,CURLOPT_COOKIE,$this->cookie);//提交cookie 多个之间加; 一个分号+一个空格
curl_setopt($this->ch,CURLOPT_COOKIEJAR,_LOCAL_COOKIE_path);//返回cookies作为文件保存
curl_setopt ( $this->ch, CURLOPT_SSL_VERIFYPEER, $this->https ); //https访问,禁用安全验证
curl_setopt($this->ch,CURLOPT_POST,1);//开启后 为POST
curl_setopt($this->ch,CURLOPT_POSTFIELDS,$this->data);//POST数据
$data=curl_exec($this->ch);
return $data;
}
}
$url=new web_get();
$first=urlencode('第一个'.mt_rand(1,100));
$second=urlencode('第二个'.mt_rand(1,100));
$third=urlencode('第三个'.mt_rand(1,100));
$return=$url->_getweb($url->url='http://tp.388g.com/aosbegin00006.php?id=736&text1='.$first.'&text2='.$second.'&text3='.$third.'&text4=undefined&text5=undefined&rnd=0.817423045868054');
$pos=strpos($return, 'tmp/');
$pos2=strpos($return, 'gif');
$pic_url='http://tp.388g.com/maker/'.substr($return,$pos,$pos2-$pos).'gif';
?>
<img src="<?php echo $pic_url; ?>" />
|
|