Closed glenscott closed 9 years ago
Using the example from @gitboss listed here https://github.com/J7mbo/twitter-api-php/issues/111
$getfield = '?q=' . urlencode($query) . "&rpp=100" . ($max_id ? "&since_id=" . $max_id : "") ;
This query is correctly URL encoding the query parameter, so we must be sure to decode it before assembling the oAuth base string.
Hi Glen, thanks for this - could you also add a forward slash to the /
$search
and $replace
vars in setGetField()
? This is so we can actually just use ?q=http://www.google.com
in the query.
Line 139/140:
$search = array('#', ',', '+', ':', '/');
$replace = array('%23', '%2C', '%2B', '%3A', '%2F');
If you can add that, I'll merge and also write a test for it.
Actually, I realised I didn't push my complete fix. The URL logic in setGetFields has been removed -- you need to amend your documentation to make it cleat that any GET parameters should be urlencoded before before being passed to this function.
Actually, the aim was for the user not to have to encode anything before passing the data to setGetField()
. They should just be able to type the query in plain english and the lib would take care of the rest (most user friendly imho anyway :-))
Ok, no worries. Let me correct the encoding logic in setGetFields.
Ok, I've used the urlencode function to cope with any non-standard characters in query parameters, rather than just '#', ',', '+', ':', '/'
Looks like the testStatusesRetweetsOfMe()
is failing now, thanks travis!
would you like me to look into this failing test?
@glenscott It's alright I'm taking a look atm, if I find anything I'll let you know :+1:
GET parameters that have been URL encoded need to be decoded before adding to oAuth.