|
发表于 2018-12-1 18:11:11
|
显示全部楼层
- <?php
- $arr['username'] = 'XXX';//XXX改成你的登录名
- $arr['password'] = 'OOO';//OOO改成你的密码
- $cookie_file = tempnam('./temp','cookie');
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,'https://www.hostloc.com/member.php?mod=logging&action=login&loginsubmit=yes');
- curl_setopt($ch, CURLOPT_HEADER, TRUE);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5');
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $arr);
- curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
- curl_exec($ch);
- curl_close($ch);
-
- for($i=1; $i<=10; $i++){
- echo http_get_uid('https://www.hostloc.com/space-uid-'.$i.'.html',$cookie_file);
- }
-
- function http_get_uid($url,$cookie_file){
- $curl = curl_init($url);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5');
- curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_file);
- $data = curl_exec($curl);
- curl_close($curl);
- return $data;
- }
- ?>
复制代码
比之前多了2行ssl
for访问时候不知道能不能用 frame来显示。 |
|