doumo2501 2013-06-24 18:19
浏览 22

Twitch电视频道信息:不起作用

I want to get information about a channel, is it online at the moment or not:

$stream_list = ...;

$mycurl = curl_init();

curl_setopt ($mycurl, CURLOPT_HEADER, 0);
curl_setopt ($mycurl, CURLOPT_RETURNTRANSFER, 1);

//Build the URL
$url = "http://api.justin.tv/api/stream/list.json?channel=" . $stream_list;
curl_setopt ($mycurl, CURLOPT_URL, $url);

$web_response =  curl_exec($mycurl);

but thats always return with an empty array. I saw many example based on it - mine wont work, what am I doing wrong?

  • 写回答

2条回答 默认 最新

  • duanlushen8940 2013-06-24 18:34
    关注

    An empty array probably means nothing was found with the stream list you provided.

    I used http://api.justin.tv/api/stream/list.json?channel=beyondthesummit,towelliee and was able to get an array from the API, and then I used http://api.justin.tv/api/stream/list.json?channel=foobar and got an empty JSON array back.

    I'd make sure $stream_list has the value you expect. And if it does, try removing the channel filter completely to see if you get results.

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)