3

sorry if my english not very good,

i have a file, please check http://www.tvlangsung.com/jwplayer-drive/google.php

that google.php is

    <?php
$link = 'https://drive.google.com/file/d/0B1xQLLJtrzJoaWUxUHdqY01mRGM/view';
$api = 'https://api.blogit.vn/getlink.php?link='.$link.'&json=jwplayer';
$sources = curl($api);
function curl($url)
{
    $ch = @curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    $head[] = "Connection: keep-alive";
    $head[] = "Keep-Alive: 300";
    $head[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
    $head[] = "Accept-Language: en-us,en;q=0.5";
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36');
    curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
    curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_TIMEOUT, 60);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    $page = curl_exec($ch);
    curl_close($ch);
    return $page;
}
?>

<?php echo $sources; ?>

the question is how can separated that data

so i can make a download button like

<a href="<?php echo $480p; ?>" target="_blank">Download 480p</a>
<a href="<?php echo $360p; ?>" target="_blank">Download 360p</a>

how can i take that redirector link for each quality ?

please help, im a newbie

2 Answers 2

2

You need to parse the results as json with the json_decode() method with your data. Then you can loop over the results. Remember the results are objects so you have to access them as such and not as arrays.

$data = json_decode($sources);

foreach($data as $file) {
  echo '<a href="' . $file->file . '" target="_blank">Download '. $file->label . 'p</a><br/>';
}

That should provide the links that you are looking to create.

Sign up to request clarification or add additional context in comments.

Comments

1

You should parse the json file and generate button with the type attribute. It 's and array you should.

$array = json_decode($sources);
foreach($array as $s){
  if($a['type']=="mp4"){ 
    put your link code here
  }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.