Задался вопросом как скачать если ссилки на iflame хранить в базе
27.10.2012 / 12:34
<?php
ini_set('max_execution_time', '0');
header('Content-Type: text/html; charset=utf-8');
$url_in = 'http://vk.com/video_ext.php?oid=9560761&id=149655022&hash=59d6e838c2a8a138&sd';
echo vk_video($url_in); // Запускаем основную функцию
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;
}
function vk_video($url_in){
$vk_video = curl($url_in);
preg_match('|host=(.*)&|Uis', $vk_video, $link1);
preg_match('|vkid=(.*)&|Uis', $vk_video, $link2);
preg_match('|vtag=(.*)&|Uis', $vk_video, $link3);
echo '<a href="http://'.$link1[1].'/assets/videos/'.$link3[1].$link2[1].'.vk.flv">http://'.$link1[1].'/assets/videos/'.$link3[1].$link2[1].'.vk.flv</a>';
}...