Gnziet Gnziet - 1 year ago 231
JSON Question

file get content with json not working

example output :


"title":"Happy Forever Alone Day (Forever Alone Song)",
"link":"http:\/\/\/download\/get\ /?i=k1MakL%2FYlh6KUtEHqyQlg9XwtUUWO"


i want to get this using php json file get content but this is not working.

$json_url = "";
$json = file_get_contents($json_url);
$data = json_decode($json, TRUE);
echo "<pre>";
echo "</pre>";

but nothing working please help me ..
$json_url = "$videoid";
$videoid is dyanamic value getting using post variable .

likie as

echo $video;?>


Answer Source

Using this code to get your output.

$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_URL, '');
curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);

$jsonData = json_decode(curl_exec($curlSession));
echo "<pre>";
echo "</pre>"; 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download