Merhaba 1 sene once yazmıştım çalışıyormu bilmiyorum sunucuda temizlik yapcam belkı birinin işine yarar diye paylaşıyorum.


10dk da felan yazıldı çok basit bir şekılde yazdım.

Mail.Ru PHP Dosyası
<?
	class mailruapi{
	
		public function videolink($url){
				$ch = curl_init();
				curl_setopt($ch, CURLOPT_URL, strip_tags($url));
				curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
				curl_setopt($ch, CURLOPT_TIMEOUT, 10);
				$output = curl_exec($ch);
				
				preg_match('#"metadataUrl":"(.*?)","autoplay"#si',$output,$json); 
				$mp4 = file_get_contents($json[1]);
				$json = json_decode($mp4, true);
				
				header("Content-type: video/mp4");
				readfile($json['videos'][0]['url']);
				
		}
		
		public function videoresim($url){
				$ch = curl_init();
				curl_setopt($ch, CURLOPT_URL, strip_tags($url));
				curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
				curl_setopt($ch, CURLOPT_TIMEOUT, 10);
				$output = curl_exec($ch);

				preg_match('#"metadataUrl":"(.*?)","autoplay"#si',$output,$json); 
				$mp4 = file_get_contents($json[1]);
				$json = json_decode($mp4, true);
				
				$imginfo = getimagesize($json['meta']['poster']);
				header("Content-type: ".$imginfo['mime']);
				readfile($json['meta']['poster']);
				
		}
		
		function __destruct(){
				@curl_close($ch); 
		}
	}
	
	error_reporting(0);
	if(htmlspecialchars($_GET['link'])){
		$video = new mailruapi;
		
		$link = "http://videoapi.my.mail.ru/videos/embed/mail/filmleriizlesene/_myvideo/2579.html";
		echo $video->videolink($link);
	}
	
	if(htmlspecialchars($_GET['resim'])){
		$video = new mailruapi;
		
		$link = "http://videoapi.my.mail.ru/videos/embed/mail/filmleriizlesene/_myvideo/2579.html";
		echo $video->videoresim($link);
	}

?>

VK PHP Dosyası
<?
	class vkapi{
	
		public function videolink($url){
				$ch = curl_init();
				curl_setopt($ch, CURLOPT_URL, strip_tags($url));
				curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
				curl_setopt($ch, CURLOPT_TIMEOUT, 10);
				$output = curl_exec($ch);

				preg_match('#var vars \= (.*?)var fixed_player_size#si',$output,$json); 
				$json = json_decode($json[1],true);
				
				header("Content-type: video/mp4");
				readfile($json['url480']);
				//*return $json['url480'];
		}
		
		public function videoresim($url){
				$ch = curl_init();
				curl_setopt($ch, CURLOPT_URL, strip_tags($url));
				curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
				curl_setopt($ch, CURLOPT_TIMEOUT, 10);
				$output = curl_exec($ch);

				preg_match('#var vars \= (.*?)var fixed_player_size#si',$output,$json); 
				$json = json_decode($json[1],true);
				
				$imginfo = getimagesize($json['jpg']);
				header("Content-type: ".$imginfo['mime']);
				readfile($json['jpg']);
				
		}
		
		function __destruct(){
				@curl_close($ch); 
		}
	}
	
	error_reporting(0);
	if(htmlspecialchars($_GET['link'])){
		$video = new vkapi;
		
		$link = $_GET['link']."&id=".$_GET['id']."&hash=".$_GET['hash']."&hd=".$_GET['hd'];
		echo $video->videolink($link);
	}
	
	if(htmlspecialchars($_GET['resim'])){
		$video = new vkapi;
		
		$link = $_GET['resim']."&id=".$_GET['id']."&hash=".$_GET['hash']."&hd=".$_GET['hd'];
		echo $video->videoresim($link);
	}

?>


player.php
	<br /><br />
	<center>
		<!---
		<form action="" method="POST">
			VK Linki Yazın! <br />
			<input type="text" name="vklink"/><br /><br />
			<input type="submit" value="Önizle"/><br /><br />
			
		</form>
		--->
	<style>
		video { background-color: black; }
	</style>	
		
	<video controls poster="vk.class.php?resim=http://vk.com/video_ext.php?oid=233316360&id=168968026&hash=c70c3cdf02427258&hd=3">
	  <source src="vk.class.php?link=http://vk.com/video_ext.php?oid=233316360&id=168968026&hash=c70c3cdf02427258&hd=3" type="video/mp4">
	</video>
	
	
	<br /><br /><br />
		VK Video Resmi için : vk.class.php?resim=<b>VK Linki</b> <br />
		VK Video Videosu için : vk.class.php?link=<b>VK Linki</b> <br />
	
	</center>