Reputation: 83
How to put the querystring name in php?
$file_get_html('http://localhost/search/?q=');
And when accessing localhost/?name=example
the code looks like this
$file_get_html('http://localhost/search/?q=example');
I do not know how to put $_GET['url']
inside a php :(
Upvotes: 0
Views: 451
Reputation: 123
$url = urlencode($_GET['url']);
$contents = file_get_contents("http://localhost/search/?q={$url}");
var_dump($contents);
Upvotes: 0
Reputation: 661
The ?q=example will let you use something like $example = $_GET['q'], and $example should equal the value of q in your querystring.
If you have a querystring that looks like this:
?q=example&url=myurl.com
You can access the q and url parameters like this:
$q = $_GET['q']; // which will equal 'example'
$url = $_GET['url']; // which will equal 'myurl.com'
If that is what you are trying to do.
Upvotes: 0
Reputation: 780798
The question isn't very clear, but I suspect this is the answer:
file_get_html('http://localhost/search/?q=' . urlencode($_GET['url']));
Upvotes: 1