求个地址获取的代码详细请见帖子
比如土豆的视频地址为:http://www.tudou.com/a/opofdzoe_mi/&iid=131686432&resourceid=0_04_05_99/v.swf
直接访问后为:
http://js.tudouui.com/bin/player2/olc_8.swf?iid=131686432&swfpath=http://js.tudouui.com/bin/lingtong/socialplayer_79.swf&youkuid=xnjc0mte5mdky&vcode=xnjc0mte5mdky&tvccode=-1&tag=null&title=%e7%ac%ac07%e8%af%9d+%e8%80%8d%e9%98%b4%e9%99%a9%e2%80%a6%e2%80%a6%21%21&mediatype=vi&totaltime=1434760&hdtype=3&haspassword=0&nwidth=512&isoriginal=0&channelid=9&nheight=288&banpublic=false&videoowner=102599789&tict=2&tvccode=-1&channelid=9&cs=6_480|482&k=&totaltime=1434760&panelrecm=http://css.tudouui.com/bin/lingtong/panelrecm_9.swz&paneldanmu=http://css.tudouui.com/bin/lingtong/paneldanmu_1.swz&panelend=http://css.tudouui.com/bin/lingtong/panelend_11.swz&pepper=http://css.tudouui.com/bin/binder/pepper_17.png&panelshare=http://css.tudouui.com/bin/lingtong/panelshare_7.swz&panelcloud=http://css.tudouui.com/bin/lingtong/panelcloud_8.swz&prd=&autoplay=false&listtype=3&rurl=&resourceid=0_04_05_99&autostart=false&lid=0&aid=228258&acode=opofdzoe_mi&code=jh-1k_odtwe&snap_pic=http%3a%2f%2fr1.ykimg.com%2f054104085301e3696a0a4f52041d537c&aoprate=0.001&p2prate=0.95&adsourceid=81000&yjuid=1392279724827k3i&yseid=1392887009649tqcvcx&yseidtimeout=1392898462767&yseidcount=4&uid=null&juid=018h4v26uu19ca&vip=0
怎么样用php获取访问后的地址并输出
------解决方案--------------------
$url='http://www.tudou.com/a/opofdzoe_mi/&iid=131686432&resourceid=0_04_05_99/v.swf';
$ch = curl_init($url);
curl_setopt($ch, curlopt_followlocation, false);
curl_setopt($ch, curlopt_returntransfer, true);
curl_setopt($ch, curlopt_header, true);
curl_exec($ch);
$response = curl_exec($ch);
preg_match_all('/^location:(.*)$/mi', $response, $matches);
curl_close($ch);
echo !empty($matches[1]) ? trim($matches[1][0]) : 'no redirect found';