Reputation: 2639
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?
Upvotes: 2
Views: 1465
Reputation: 21
why not simplify and use urlencode('http://www.google.com');
???
Upvotes: 0
Reputation: 3038
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:
$_SERVER['REQUEST_URI'] = str_replace('http://', 'http:', $_SERVER['REQUEST_URI']);
Upvotes: 4