Screenleap在php中返回NULL

时间:2013-11-08 11:52:28

标签: php api curl broadcast screensharing

我在screenleap中创建了开发者帐户,并尝试将screenleap API集成到我的应用程序中,但是当我尝试使用screenleap生成的示例请求代码时,它给了我NULL。

如何在php中测试样本请求?

    $url = 'https://api.screenleap.com/v2/screen-shares';
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('authtoken:my_authtoken'));
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'accountid=my_accountid');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $data = curl_exec($ch);
    curl_close($ch);
    $json = json_decode($data,true);
    var_dump($json);

1 个答案:

答案 0 :(得分:0)

您的系统默认值可能不适用于SSL证书验证。

您可以尝试使用以下方式关闭验证:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

如果有效,请参阅http://php.net/manual/en/function.curl-setopt.phphttp://curl.haxx.se/docs/sslcerts.html了解详情。