Hi! I’m trying to “repair” my API classes for my bot since they now require the Client-ID to be sent. I’ve registered my application and everything, and with “Header-Editor”(Chrome Extension) I can get it to work but I just cannot figur out how to make a cURL call in PHP that sends the Client-ID with it…
If I understand what you’ve written (and I am no cURL/PHP expert, you’ve been warned ), you are making the API call on the line $response = curl_exec($ch); but you then attempt to make the same call again but this time, you are feeding a URL through variables without the clientID - that is on this line $followAPI = json_decode(@file_get_contents(channelsApi . $channelName), true);
You should be able to alter that line to use the response from cURL: $followAPI = json_decode($response, true); - if that still doesn’t work, post what error you receive.
Worst case scenario, we should be able to do without the cURL and use: $followAPI = json_decode(@file_get_contents($channelsApi . $channelName . "?clientID=" . $clientId), true);
Also, as a note: @file_get_contents is blocked on some hosting servers for security reasons, but I can’t remember the alternative to it :banging head on desk:
I’ve tried this, however, it just does not show any data… I’m using the exact code you quoted there, put my channel & clientId in, but it displays nothing but a blank page…
Make sure you do this before curl_close. It will output the error if there was a problem with the request or an empty string if there was no error. I’m guessing it is an invalid Client-ID.