How can i get contnts from url Text or Json Format
i am trying to get shortened url created using api link, i am using to methods to get result url, Test and Json. but Bot are not workig for me. Can someone help in this regards.
My Code Using Text Format
$apilink="https://bitcoinly.in/api?api=API-KEy";
$toshort="https://anysite.com/links/verify";
$links = "$apilink&url=$toshort&format=text";
$lines = file($links);
$link= $lines[0];
echo $link;
Using Json Format
$links = "$apilink&url=$toshort&format=json";
$json = file_get_contents($links);
$data = json_decode($json,true);
$link = $data['shortenedUrl'];
echo $link;