mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-26 23:45:49 +03:00
[GH-ISSUE #245] cURL transport error: 7 Failed to connect to api.spotify.com port 443: Timed out in #176
Labels
No labels
bug
docs
enhancement
enhancement
enhancement
feedback wanted
good first issue
help wanted
help wanted
help wanted
invalid
pull-request
question
question
upstream
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-web-api-php#176
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @omadepod on GitHub (Jan 12, 2022).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/245
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
@jwilsson commented on GitHub (Jan 12, 2022):
Hi!
Are you behind a firewall, proxy, or similar? That's usually the issue with these kind of errors.
@omadepod commented on GitHub (Jan 12, 2022):
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.
@jwilsson commented on GitHub (Jan 13, 2022):
Hmm, does it work connecting to any other URL. For example:
@omadepod commented on GitHub (Jan 14, 2022):
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
@jwilsson commented on GitHub (Jan 15, 2022):
Have you tried increasing the timeout for cURL using the
CURLOPT_CONNECTTIMEOUT,CURLOPT_TIMEOUT, or both of those options? if not, docs around that is available here. You also try setting theCURLOPT_CAINFOoption tonulland see if that makes any difference.@omadepod commented on GitHub (Jan 15, 2022):
with
protected $options = [
'curl_options' => [CURLOPT_CONNECTTIMEOUT => 0, CURLOPT_TIMEOUT => 0],
'return_assoc' => false,
];
there's no difference
with
protected $options = [
'curl_options' => [CURLOPT_CAINFO => null],
'return_assoc' => false,
];
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
@jwilsson commented on GitHub (Jan 16, 2022):
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 😄
@omadepod commented on GitHub (Jan 18, 2022):
for example on this one :
$arr = $api->getMyTop("tracks", ["limit" => 2, "time_range" => "short_term"]);
';echo '
exit();
@jwilsson commented on GitHub (Jan 20, 2022):
Can you try with another method?
$api->me()for example. But you're able to get the access tokens correctly without any errors?@omadepod commented on GitHub (Jan 21, 2022):
$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
are empty though.
@jwilsson commented on GitHub (Jan 23, 2022):
This is very strange. But you said you could access
api.spotify.comusing a browser, right? Could you also try the following:api.spotify.comand see if that works.hostsfile to see that there's nothing in there pointingapi.spotify.comsomewhere else.@omadepod commented on GitHub (Mar 13, 2022):
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.