回复列表(20)
  • @Ta / 03-10 10:46 / /
    简单呀,看请求头呀
  • @Ta / 03-10 11:17 / /
    @echo醉老仙,能不能来个php实例😂我整吐了,Java跟php都是没成功,
  • @Ta / 03-10 11:42 / /
    @wuyiyi,是要获取?location?
  • @Ta / 03-10 11:51 / /
    @大尨,要获取跳转后的真实地址
  • @Ta / 03-10 11:52 / /
    @大尨-51c72f8ae0119a6d.png
  • @Ta / 03-10 11:53 / /
    @大尨,是滴,就是location
  • @Ta / 03-10 11:57 / /
    @wuyiyi,curl 请求的时候设置不允许重定向。然后获取头部信息就可以了。
  • @Ta / 03-10 12:36 / /
    @wuyiyi,我刚才试了下不行,正常访问就有,很奇怪,哈哈
  • @Ta / 03-10 13:05 / /
    @echo醉老仙,我也是这个情况😂
  • @Ta / 03-10 13:05 / /
    @大尨,能不能给个示范,楼上也试了跟我一个情况
  • @Ta / 03-10 13:29 / /
    @wuyiyi,我试试,等等
  • @Ta / 03-10 13:36 / /
    @wuyiyi,你试试这个自定义函数,应该是能获取的
    function call_h($url,$cookie="1234"){
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL,$url);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_USERAGENT,"Mozilla/5.0 (linux; u; android 9; zh-cn; v1816a build/pkq1.180819.001) applewebkit/537.36 (khtml, like gecko) version/4.0 chrome/57.0.2987.108 quark/4.2.1.138 mobile safari/537.36");
        curl_setopt($curl,  CURLOPT_FOLLOWLOCATION, 1); 
        curl_setopt($curl, CURLOPT_COOKIE, $cookie);
        curl_setopt($curl,CURLOPT_TIMEOUT,3);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        $data = curl_exec($curl);
        $data = curl_getinfo($curl);
        //$data=$data[url];
        curl_close($curl);
    if($data)
    return $data[url];
    else
    return false;
    
    }
    
    
  • @Ta / 03-10 14:00 / /
    @,老哥,还是不行,cookie我提取后来用也是一样
  • @Ta / 03-10 14:07 / /
    @wuyiyi

    <?php
    function curlHttp($url, $retJson = false){
    	$headerArray = [
            'Connection: keep-alive',
            'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"',
            'sec-ch-ua-mobile: ?0',
            'sec-ch-ua-platform: "Windows"',
            'Upgrade-Insecure-Requests: 1',
            'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36',
            'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
            'Sec-Fetch-Site: none',
            'Sec-Fetch-Mode: navigate',
            'Sec-Fetch-User: ?1',
            'Sec-Fetch-Dest: document',
            'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8'
    	];
    
    	$ch = curl_init();
    	curl_setopt($ch, CURLOPT_URL, $url);
    	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
    	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);    // 禁止重定向
        curl_setopt($ch, CURLOPT_HEADER, 1);
        curl_setopt($ch, CURLINFO_HEADER_OUT, true);
    	curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray);
    	$output = curl_exec($ch);
        //echo curl_getinfo($ch, CURLINFO_HEADER_OUT);
    	curl_close($ch);
    	if($retJson === true){
    		$output = json_decode($output,true);
    	}
    	return $output;
    }
    
    $url = 'http://511i.cn/td/a.php';
    $res = curlHttp($url);
    $url = trim(explode('开始转302',$res)[1]);
    $res = curlHttp($url);
    var_dump($res);
    
  • @Ta / 03-10 14:07 / /
    1646892051(1).jpg
  • @Ta / 03-10 14:12 / /
    @wuyiyi,他这个可以的@大尨,,已经验证360截图20220310141127585.jpg
  • @Ta / 03-10 14:20 / /
    我用的 https://github.com/php-curl-class/php-curl-class
    $headerArray = [
    	'Sec-Fetch-User: ?1',
    	'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8'
    ];
    use Curl\Curl;
    $curl=new Curl();
    $curl->setOpt(CURLOPT_SSL_VERIFYPEER,false);
    $curl->setOpt(CURLOPT_SSL_VERIFYHOST,false);
    $curl->setHeaders($headerArray);
    $curl->get($url);
    print_r($curl->responseHeaders);
    
  • @Ta / 03-10 14:15 / /
    @大尨,大佬,这个可以了
  • @Ta / 03-10 14:15 / /
    @echo醉老仙,上面那个大佬的可以了,你这个我没试
添加新回复
回复需要登录