似毛非毛 发表于 2024-4-13 16:00
访问的时候加ua。不加ua会跳转。curl --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537 ...
似毛非毛 发表于 2024-4-13 16:00
访问的时候加ua。不加ua会跳转。curl --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537 ...
i HTTP/1.1 302 Moved Temporarily Server: nginx Date: Sat, 13 Apr 2024 08:26:28 GMT Content-Type: text/html Content-Length: 138 Connection: keep-alive Location: https://www.ipshudi.com/ x-ws-request-id: 661a41b4_houdxin43_20924-28142
302 Found
nginx
似毛非毛 发表于 2024-4-13 16:00
访问的时候加ua。不加ua会跳转。curl --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537 ...
_leo 发表于 2024-4-13 17:31
说明你ua头没加对呗。又不把代码发出来,都不知道怎么帮你
function curl_ip($url)
{
$ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36";
$ch = curl_init();
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, $ua);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
_leo 发表于 2024-4-13 17:31
说明你ua头没加对呗。又不把代码发出来,都不知道怎么帮你
function ip_curlGet($url)
{
$ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// 输出头
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_FALSESTART, true);
//模拟常用浏览器的 useragent
curl_setopt($ch, CURLOPT_USERAGENT, "{$ua}");
// 不跟随跳转
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
icon 发表于 2024-4-13 17:38
前两个连接,我的浏览器是直接404。应该是检查了referer。
似毛非毛 发表于 2024-4-13 17:56
这种页面会有各种限制的,多访问几下。直接浏览器都不让访问。直接找api接口。 ...
似毛非毛 发表于 2024-4-13 17:56
这种页面会有各种限制的,多访问几下。直接浏览器都不让访问。直接找api接口。 ...
curl --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" https://www.ip138.com/iplookup.php?ip=110.242.68.66&action=2
Telegramr 发表于 2024-4-13 18:23
用浏览器来打开,也是404了
Typeboom 发表于 2024-4-22 12:27
开个子进程调用curl吧
欢迎光临 全球主机交流论坛 (https://91ai.net/) | Powered by Discuz! X3.4 |