I’m using Fat Free Framework and I want to handle an incoming request like:
http://example.com/api/method/?user_id=1&url=http://newsite.com
I use the F3::route method to handle GET requests to this method but I get the following error:
parse_url(/method?user_id=1&url=http://newsite.com): Unable to parse URL
I think I’ve tracked this down to a problem with the PHP function parse_url() which fails on relative URLs.
Any ideas how I can get F3 to properly handle URLs in the GET query params?
I’ve run into this problem before. If you don’t have control of the incoming URL not being url-encoded, you can do this as a dirty hack before F3 is run to get rid of the slashes in the argument: