I need help to parse the names and URLs of videos from some JSON data.
<?php
$json = file_get_contents('http://odnoklassniki.ru/dk?cmd=videoPlayerMetadata&mid=507252337');
$obj = json_decode($json);
foreach($obj->videos as $videos){
$string = $videos->url;
$arr = explode('clientType=0',$string);
$string = implode('clientType=0", type:"mp4"},',$arr);
$arr = explode('http',$string);
$string = implode('{ file: "http',$arr);
echo $string;
}
?>
I need also the "name":
"name":"lowest"
"name":"low"
"name":"sd"
"name":"hd"
original url:
http://odnoklassniki.ru/dk?cmd=videoPlayerMetadata&mid=507252337
you can test it here: