So locally, everything is working great, but now that I uploaded it to my web host its not working anymore.
Please help me I am loosing my mind, I’ve tried doing
$clientId = “myid”;
$json_array = json_decode(file_get_contents('https://api.twitch.tv/kraken/streams?channel=’.$channelname.’?cliend_id=’$cliendid),true);
Full code of getStream
On line six you have the following
this should be
Just realized I pasted wrong code, will give that a try.
Still getting null.
What is the output of
On a localhost it shows info I need, but on host nope.
Using ipage for domain/host.
Try this: https://pastebin.com/KLaKTtkH and post the results.
I separate the file_get_content and json_decode so you can see the results in between. Some other changes are noted as comments.
bool(false) NULL is the result.
Guess api is returning nothing.
I just tried my files on free host, and guess what, its somewhat working. It does show random stream.
Sounds like your web hosting provider has disabled file_get_contents from retrieving data from external URLs. They commonly do this for security.
I’d recommend looking into during cURL: http://codular.com/curl-with-php
Uh I have no idea how to use curl yet, thanks for answers and all the help guys.
THANK YOU SO MUCH, IT IS WORKING NOW HOLY F""""
I literally spent 5 hours trying to fix this, thanks a lot!