更新时间:2022-12-29 21:52:59
是的,但您必须自己通过解析响应并查找类似以下内容的方式来完成:
Yes, but you'll have to do it yourself by parsing the response and looking for things that look like:
<meta http-equiv="refresh" content="5;url=http://example.com/" />
遵守 刷新请求是浏览器端的事情.使用 DOM 解析在 cURL 为您提供的响应中查找具有适当属性的
标记.
Obeying <meta>
refresh requests is a browser-side thing. Use DOM parsing to look for <meta>
tags with the appropriate attributes in the response cURL gives you.
如果你能保证响应是有效的 XML,你可以这样做:
If you can guarantee that the response is valid XML, you could do something like this:
$xml = simplexml_load_file($cURLResponse);
$result = $xml->xpath("//meta[@http-equiv='refresh']");
// Process the $result element to get the relevant bit out of the content attribute