你必须设置
follow_redirects = false
调用 fetch 时。
使用 fetch 的标准调用
fetch(url, payload=None, method=GET, headers={},
allow_truncated=False, follow_redirects=True, deadline=5,
validate_certificate=False)
像这样将follow_redirects改为false
fetch(url, payload=None, method=GET, headers={},
allow_truncated=False, follow_redirects=False, deadline=5,
validate_certificate=False)
PHP
$context = [
'http' => [
'method' => 'get',
'header' => "custom-header: custom-value\r\n" . "custom-header-two: custome-value-2\r\n",
'content' => $data,
'follow_location' => false,
]
];