Home:ALL Converter>A GET inside a GET

A GET inside a GET

Ask Time:2012-06-06T11:22:26         Author:Robert

Json Formatter

The problem i'm facing right now is im getting a URL, like so:

www.example.com/example.php?url=www.google.com

now the problem is, if theres a get in my url, like so:

www.example.com/example.php?url=www.google.com?id=1

it doesn't actually cause a problem yet, but if theres two GET vars in the my URL, it doesn't know where the "and" goes, the first get or the second one, and basically just chooses the first, ex:

www.example.com/example.php?url=www.google.com?id=1&username=me

is there a workaround? I could recode a lot of things to have it as one get variable, but it'll involve a lot of work and I wish i could have a solution! thanks!

Heres my code:

$facebookapi=new facebook(array('appId'=>'*******','secret'=>'********','fileUpload'=>'false'));
$url='http://******.com/questions/view.php?id=884&username=robot';
$facebookapi->api('/me/******app:answer?question=' . urlencode($url),'POST');

Author:Robert,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/10907776/a-get-inside-a-get
xdazz :

You need urlencode to encode the url parameter.\n\n$url = 'www.google.com?id=1';\necho 'www.example.com/example.php?url='.urlencode($url).'&username=me';\n\n\nEdit:\nAfter seeing your posted code, it seems that you should use the third parameter for params.\n\n$url='http://******.com/questions/view.php?id=884&username=robot';\n$facebookapi->api('/me/******app:answer', 'POST', array('question' => $url));\n",
2012-06-06T03:24:53
yy