xsh

xsh

面朝大海,我站成大海
🏢  奇虎360 / PHP高级程序员
V2EX 第 132325 号会员,加入于 2015-08-11 18:35:23 +08:00
根据 xsh 的设置,主题列表只有在你登录之后才可查看
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
xsh 最近回复了
2016-11-25 16:10:00 +08:00
回复了 Adia 创建的主题 Java 模拟 HttpPost 请求发送后,对面重定向了,如何获取其 URL?
php curl 取最终地址的方式,可以做一个参考(前提是结果中有 header 头信息):

$content = curl_exec($ch);
$retVal = array();
$fields = explode("\r\n", @preg_replace_callback('/\x0D\x0A[\x09\x20]+/', 'a', $content));
foreach( $fields as $field ) {
if( preg_match('/([^:]+): (.+)/m', $field, $match) ) {
$match[1] = @preg_replace_callback('/(?<=^|[\x09\x20\x2D])./', 'b', strtolower(trim($match[1])));
if( isset($retVal[$match[1]]) ) {
$retVal[$match[1]] = array($retVal[$match[1]], $match[2]);
} else {
$retVal[$match[1]] = trim($match[2]);
}
}
}
if(!is_array($retVal)) {
return false;
}
return $retVal['location'];
2016-10-11 17:24:09 +08:00
回复了 yuanchao 创建的主题 PHP 目前有哪些扩展不支持 php 7 ?
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5438 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 08:10 · PVG 16:10 · LAX 01:10 · JFK 04:10
Developed with CodeLauncher
♥ Do have faith in what you're doing.