-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cURL transport error: 7 Failed to connect to api.spotify.com port 443: Timed out in #245
Comments
Hi! |
Hi! I have windows firewall running but firefox is allowed there and i have orange internet for which i never need to use a proxy. |
Hmm, does it work connecting to any other URL. For example: <?php
require 'vendor/autoload.php';
$request = new SpotifyWebAPI\Request();
var_dump($request->send('GET', 'https://example.com')); |
yes this works perfectly : array(4) { ["body"]=> NULL ["headers"]=> array(13) { ["content-encoding"]=> string(4) "gzip" ["accept-ranges"]=> string(5) "bytes" ["age"]=> string(6) "465613" ["cache-control"]=> string(14) "max-age=604800" ["content-type"]=> string(24) "text/html; charset=UTF-8" ["date"]=> string(29) "Fri, 14 Jan 2022 12:12:20 GMT" ["etag"]=> string(17) ""3147526947+gzip"" ["expires"]=> string(29) "Fri, 21 Jan 2022 12:12:20 GMT" ["last-modified"]=> string(29) "Thu, 17 Oct 2019 07:18:26 GMT" ["server"]=> string(14) "ECS (dcb/7F15)" ["vary"]=> string(15) "Accept-Encoding" ["x-cache"]=> string(3) "HIT" ["content-length"]=> string(3) "648" } ["status"]=> int(200) ["url"]=> string(19) "https://example.com" } my fatal error in my test script: Fatal error: Uncaught SpotifyWebAPI\SpotifyWebAPIException: cURL transport error: 28 Failed to connect to api.spotify.com port 443: Timed out in C:_xampp\htdocs\system\spotify\src\Request.php:225 Stack trace: #0 C:_xampp\htdocs\system\spotify\src\Request.php(132): SpotifyWebAPI\Request->send('GET', 'https://api.spo...', 'limit=20&time_r...', Array) #1 C:_xampp\htdocs\system\spotify\src\SpotifyWebAPI.php(124): SpotifyWebAPI\Request->api('GET', '/v1/me/top/trac...', Array, Array) #2 C:_xampp\htdocs\system\spotify\src\SpotifyWebAPI.php(1227): SpotifyWebAPI\SpotifyWebAPI->sendRequest('GET', '/v1/me/top/trac...', Array) #3 C:_xampp\htdocs\system\spotify\src\SpotifyWebAPI.php(2105): SpotifyWebAPI\SpotifyWebAPI->getMyTop('tracks', Array) #4 C:_xampp\htdocs\includes\ajax_spotify.php(283): SpotifyWebAPI\SpotifyWebAPI->mycms_get_spotify_my_top('tracks', 'short_term') #5 {main} thrown in C:_xampp\htdocs\system\spotify\src\Request.php on line 225 |
Have you tried increasing the timeout for cURL using the |
with protected $options = [ there's no difference with protected $options = [ i get this new error : Fatal error: Uncaught SpotifyWebAPI\SpotifyWebAPIException: cURL transport error: 77 error setting certificate verify locations: CAfile: CApath: none in C:_xampp\htdocs\system\spotify\src\Request.php:225 Stack trace: #0 C:_xampp\htdocs\system\spotify\src\Request.php(110): SpotifyWebAPI\Request->send('POST', 'https://account...', 'grant_type=refr...', Array) #1 C:_xampp\htdocs\system\spotify\src\Session.php(204): SpotifyWebAPI\Request->account('POST', '/api/token', Array, Array) #2 C:_xampp\htdocs\system\spotify\src\class.omdp.spotify.php(55): SpotifyWebAPI\Session->refreshAccessToken('AQB4tGsSLV7mg8l...') #3 C:_xampp\htdocs\system\spotify\index.php(151): Spotify_api_access->mycms_get_spotify_connection() #4 {main} thrown in C:_xampp\htdocs\system\spotify\src\Request.php on line 225 |
Hmm, which API method are you using when the error occurs? Does it work for other methods or is it always the same error? I can't reproduce it locally and there's been a number of people with this kind of issue over the years but we've never been able to solve it, hence all the questions. I'm a but curious of what it could be and would like to find at least one solution to it 😄 |
for example on this one : $arr = $api->getMyTop("tracks", ["limit" => 2, "time_range" => "short_term"]); '.print_r( $arr, 1 ).''; exit(); |
Can you try with another method? |
$api->me(); gives the same error ... and no i don't get errors with the access tokens. [session:protected] => SpotifyWebAPI\Session Object is filled with information. The other fields in SpotifyWebAPI\SpotifyWebAPI Object |
This is very strange. But you said you could access
|
I removed a bad ip i found somewhere on internet from my hosts file and now i have correct results with $api->me(); Seems like i get blocked when trying too much requests in my scripts. After a big script i get errors and can't even connect to my account but when i refresh it works again. For example i want to find new releases from all my favourite artists so i need to query all my playlists, then albums from the artists and their date of release. Doing this gives the original Failed to connect to api.spotify.com port 443: Timed out error. |
Since about a year my scripts stop in the middle of my page with the curl transport error (see subject). I tried adding a sleep(1) command but it doesn't help much.
Many thanks
The text was updated successfully, but these errors were encountered: