Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php $_GET error

Tags:

php

$url = $_GET['url'];
echo "$url";

and I request /test.php?url=ok

gives me ok as output..

but I use a url test.php?url=http://google.com

gives me 403- Forbidden error.. I donno why it's not working ..

Please help me..

like image 795
Vamsi Krishna B Avatar asked Jan 22 '23 18:01

Vamsi Krishna B


2 Answers

This is often caused by overcautious settings of mod_security, an Apache extension. You'll have to consult your provider. (But they usually disable this individually or relax the settings.)

like image 113
mario Avatar answered Feb 03 '23 13:02

mario


Since characters like : and / etc are special characters in URLs, you cannot use them as part of a query string like that. You need to encode what you are passing in as a URL - in php that is done by the urlencode function, and will look like this:

test.php?url=http%3A%2F%2Fgoogle.com

like image 27
user11977 Avatar answered Feb 03 '23 12:02

user11977