im trying to fix an online/offline system on my site but no matter what i do it will only show offline. can someone plx help me out …
this is what i use :
This looks like it was butchered from code written for checking several channels at once. I assume you are just trying to show if a single streamer is ONLINE/OFFLINE?
See the snippet below, you can use this with an array of channels of course… but in the line i marked you have grave quotes instead of single quotes. This is breaking your check, I believe… any how… I added an example that uses cURL like Barry suggested.
When I first saw this I thought you were just trying to check a single channel, so I made this updated snippet… It uses cURL and v5 for checks but can be modified for any case.
thnx so much for this got it to work with one streamer thnx
know time to find out how to fix the syntax error when adding one extra to the one you already placed
ok been trying all night but cant figure out what im doing wrong… everytime i add an extra streamer i get a syntax error about ‘,’, not correct… how can i fix that and is it ok that when the systems go live i refer to all the help here / give you all full credit for the fix ?
That’s because you didn’t read the Docs or seem to have a working knowledge of PHP
Changing:
$channelName = 'matt_thomas'
to
$channelName = 'matt_thomas','another'
Won’t work as that’s invalid PHP, which is what I assume you did. Given the error you stated.
Additionally the provided code sample will not complete the stream lookup since it is not looping and can only look up one stream.
Something like the following using helix instead
Will let you lookup up to 100 streams without performing any cURL loops
(Not tested it jsut threw it together this is pre coffee code. It has some gotchas in it with dealing with non English usernames, but that is a different story. I would NOT use this in production.
im trying to learn it with this project so im verry greatfull for al the help and feedback and actual explanation i get here about what i did wrong instead of instand fixes or no room to learn
im trying serveral option right now including trying to make it read from a data but and this version as well
so far im trying to figure out the ‘$url’ (T_VARIABLE) error of this one
now im working on how to hide the offline channels and i have te feeling i have to do that by changing the :
foreach ($channels as $channel) { part.
so far i got this but cant get it to read $channel for the small video preview