how to i get only URL in json in PHP -
how data in json of mention format want data formate of json
{"22":{"quality":"22","type":"video\/mp4","url":"http://
please guide me how can this.
in advance
i have try code
$url = 'http://api.miyulasi.com/youtube/1.0.0/download.php?id=7lcdeyxw3mm'; $data = file_get_contents($url); header('content-type: application/json'); echo $data;
and responde this
<div class="col-md-3 col-sm-3 col-xs-6 text-center downbuttonbox"><a href="http://redirector.googlevideo.com/videoplayback?
here go
<?php $url = 'http://api.miyulasi.com/youtube/1.0.0/download.php?id=7lcdeyxw3mm'; $data = file_get_contents($url); $doc = new domdocument(); @$doc->loadhtml($data); $xpath = new domxpath($doc); $links = array(); $expression = "//a[contains(@class, 'btn btn-default btn-sm downbuttonstyle')]"; foreach($xpath->evaluate($expression) $link) { $content = $link->textcontent; $link = $link->getattribute('href'); preg_match("/&mime=([^&]*)&/", $link, $mime); preg_match("/&itag=([^&]*)&/", $link, $itag); preg_match("/\((.*)\)/", $content, $quality); $links[] = array("itag" => $itag[1], "type" => $mime[1], "url" => $link, "quality" => $quality[1]); } header('content-type: application/json'); echo json_encode($links, json_pretty_print);
Comments
Post a Comment