使用客户端标头/ IP检索卷曲数据

时间:2012-11-13 14:50:37

标签: php curl http-headers

$url_in = 'http://vk.com/video_ext.php?oid=3145131&id=159485516&hash=d821df23b7dc0b54&hd=1';  
function curl($url, $cookie = false, $post = false, $header = false, $follow_location = false)  
{ 
$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_FAILONERROR, true); 
curl_setopt($ch, CURLOPT_HEADER, $header); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $follow_location); 
if ($cookie) { 
    curl_setopt ($ch, CURLOPT_COOKIE, $cookie); 
} 
if ($post) { 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post); 
} 
$response = curl_exec ($ch); 
curl_close($ch); 
return $response; 
} 

$vk_video = curl($url_in); 
preg_match('|host=(.*)&|Uis', $vk_video, $link1); 
preg_match('|uid=(.*)&|Uis', $vk_video, $link2); 
preg_match('|vtag=(.*)&|Uis', $vk_video, $link3); 
$link= $link1['1'].'u'.$link2['1'].'/video/'.$link3['1'].'.360.mp4';
echo $link;

问题是vtag=对于每个ip客户端都不同,那么如何使用客户端ip检索vtag

0 个答案:

没有答案