Soundcloud: The requested URL responded with HTTP code 0

て烟熏妆下的殇ゞ 提交于 2019-12-01 05:16:33

问题


I moved my code base from one server to another - no code change, the only difference being https. I modified my app in Soundcloud developers to be https://url , however I continuously receive this error:

[20-Sep-2013 15:08:35 Europe/London] PHP Fatal error:  Uncaught exception 'Services_Soundcloud_Invalid_Http_Response_Code_Exception' with message 'The requested URL responded with HTTP code 0.' in /system/soundcloud/Soundcloud.php:945
Stack trace:
#0 /soundcloud/Soundcloud.php(298): Soundcloud->_request('https://api.sou...', Array)
#1 /application/controllers/speaker/media.php(190): Soundcloud->credentialsFlow('soundcloud@...', '073ffbc3b66691c...')
#2 [internal function]: Media->add_audio()
#3 /system/core/CodeIgniter.php(359): call_user_func_array(Array, Array)
#4 /index.php(202): require_once('/home/iwantasp/...')
#5 {main}
  thrown in /system/soundcloud/Soundcloud.php on line 945

Again, this code worked perfectly on the previous server, it's merely server change.

We have implemented the security cert that is usually the cause for this problem to no avail (Soundcloud (Oauth2) API getting access token fails) - we're on a linux system anyways so shouldn't make a difference.

cURL also works on this server.

What else could cause my problem?


回答1:


It's hard to debug this exception without seeing the source code. But my guess is that your problem might be related to this issue:

https://github.com/mptre/php-soundcloud/issues/3

Which means that you should modify your accessToken call and include the extra cURL parameters.

$accessToken = $soundcloud->accessToken($code, $postData, array(
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
));



回答2:


A much better solution would be to follow the answer listed on the following answer to Twitter API returns NULL on XAMPP which states that you should update the CA root certifications for your PHP solution.

For more information:

  • http://www.saotn.org/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/
  • http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/


来源:https://stackoverflow.com/questions/18919021/soundcloud-the-requested-url-responded-with-http-code-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!