hi
i am trying to do this code but in the middle of the url i would like to put my variable
$file=file_get_contents("http://www.google.com/search?&q=n93+amazon.com&btnI");
how do i do this
Thanks
Combine a variable with a url
Moderator: General Moderators
Code: Select all
$file=file_get_contents("http://www.go{$my_var}ogle.com/search?&q=n93+amazon.com&btnI"); - RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
An alternative way to do this is:
Concatenated strings are minutely faster than parsed strings. Not much to worry about in small situation, but if the need for the app ever grows... well it is better to have it handled up front, no?
Code: Select all
<?php
$file=file_get_contents('http://www.google.com/search?&q=n93+amazon.com&btnI&my_variable=' . $my_variable_value);
?>