mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-27 07:55:49 +03:00
[GH-ISSUE #214] getMyRecentTracks timestamp issue #149
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#149
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 @ghost on GitHub (Jan 2, 2021).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/214
Hi,
I'm using the
getMyRecentTracksMethod to return recent tracks.It works fine for retrieving my recent tracks but I'm experiencing issues with the pagination part of the method.
I've read your docs for how to use it and have also read the relevant Spotify docs.
I want to add next / previous links to the page displaying the recent tracks, and for that I need to retrieve the 'after' and 'before' values from the 'cursors' array returned by the API.
I am making sure to set the timestamp parameter (
x) as an integer by passing it through a string to number function.This is my code:
When I hard-code the
beforeoption value as1609412257987then the method returns an array without an issue.If I change this:
To this:
Then the method does not return an array, even though I have confirmed earlier on via
var_dump($x);that `$x' is an integer.I also made sure to try with out turning the
$xstring to an integer, but get the same result when it is defined as a string.I'm not sure what might be going on - just wondered if this is an issue with the actual Spotify API's method rather than the
getMyRecentTracksmethod in this respository?I could ask on the Spotify Community, but I don't know how to use their API without using the techniques used in this respository so am not sure how to ask there.
Thanks
Jim
@jwilsson commented on GitHub (Jan 2, 2021):
Hi Jim!
Right now, when using
'$x'the literal string "$x" will be sent instead of the value of$x. If you want the value to be used double quotes can be used but in this case I'd just write'before' => $xand it should work.Cheers!
@ghost commented on GitHub (Jan 2, 2021):
Hi Jonathan!
As Homer Simpson would say, Doh!!!
I feel a bit silly for not spotting that, I wasted about an hour on that :-)
Thanks again for your help and for this excellent resource.
And, Happy New Year to you.
Jim