Need to add client_id to old script

Good Morning, twich streams is important part of my site, but 2 days ago script just stoped working. I think it’s because I had not client id in script. Now I’m trying to add this but it does want to work.
That’s the error on site :

Warning: file_get_contents(,lordrenegat,xarkezpl,drwal12345,birtek,kayler01,sztuczka,balbayna,aldystv,Sonteh,onlydrzerg,lustvangoth,haluc86,wilczax,bubnik2,kesiek1981,efcek,roockqt,chaway,Codjoe,vediuk,krzysiexon,lolinsanitystream,fuks84,wneqq,sysula,Radowity,Gr4t3kiS,RandomBruce): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/nvis/public_html/ 4.0 by aWX/index.php on line 41

And that’s the code :

function StreamInfo($channels) {
$channel = implode(’,’, $channels);
$s = file_get_contents(“”.$channel);
$streamData = json_decode($s, true);
return $streamData;

Can someone want to show me what I need to paste there? I’m Really bad in php and no one know how to fix this :stuck_out_tongue:

There is a _ between client and id: “client_id”

Sorry I pasted wrong error, now it’s correct

{insert comment about how you should be using curl instead of file_get_contents}

Quick fix:

$s = file_get_contents("".$channel);

xxxxxxx being your client ID.

Oh my god! Thank you very much! You have a big beer

I have for you, a functioning example that will switch file_get_contents with cURL and allow you to set the Client ID in the header of the request.

This will set you set the Client ID once and attach it to the function file_get_contents_curl. In the long run I’d think this would make life simpler.


$clientID = array(
‘Client-ID: 0000000000000000000000000000000’

function file_get_contents_curl($url) {
$ch = curl_init();

curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);       
curl_setopt($ch, CURLOPT_HTTPHEADER, $clientID);
$data = curl_exec($ch);
return $data;


function StreamInfo($channels) {
$channel = implode(’,’, $channels);
$streamData = json_decode(@file_get_contents_curl(‘".$channel’), true);
return $streamData;


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.