从你在下面看到的代码中,即使我尝试了很长时间,也没有得到任何数据。不幸的是,当我查看浏览器时,验证码第一次出现。我尝试刷新页面,但出现空白页。
此外,还有一个名为security2的页面.php当我刷新此页面时,我不断获得新的验证码。
也很奇怪,安全和安全2.php和3.php我得到了一个空白页。
我的代码:
<?php
define('COOKIE', './cookie.txt');
header('Content-Type: image/png');
$x=rand(0,1000);
$url="http://www.turktuccar.com/security2.php?id=$x";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
$cookie = realpath('cookie.txt');
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE);
curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
$http_headers = array(
'Host: www.turktuccar.com',
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0',
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language: tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3',
'Accept-Encoding: gzip, deflate',
'DNT: 1',
'Connection: keep-alive',
'Cache-Control: max-age=0'
);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.turktuccar.com/numara-sorgula/');
curl_setopt($ch, CURLOPT_HTTPHEADER, $http_headers);
curl_exec($ch);
curl_close($ch);
?>
你必须回显curl_exec($ch);
,试试这个:
<?php
header('Content-Type: image/png');
$x=rand(0,1000);
$url="http://www.xxxxxx.com/security2.php?id=$x";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
echo curl_exec($ch);
curl_close($ch);
?>
更新:
根据您的评论,您没有在 php 上安装 curl。您可以改用file_get_contents()
,即:
<?php
header('Content-Type: image/png');
$x=rand(0,1000);
$url= file_get_contents("http://www.xxxxxx.com/security2.php?id=$x");
echo $url;
?>