I\'m trying to use php\'s file_get_content(\'a url\');
The thing is if the url has \'&\' in it, for example
file_get_contents(\'http://www.google.c
Actually, there's nothing wrong with using & as field separator in query string. It is perfectly valid and even recommended by w3c. The problem with using & is that it interacts with character entity references (which has form &xxx;).
Also, see the note in PHP manual for url_encode() function:
Be careful about variables that may match HTML entities. Things like &, © and £ are parsed by the browser and the actual entity is used instead of the desired variable name. This is an obvious hassle that the W3C has been telling people about for years. PHP supports changing the argument separator to the W3C-suggested semi-colon through the arg_separator .ini directive. Unfortunately most user agents do not send form data in this semi-colon separated format. A more portable way around this is to use
&instead of&as the separator.
If you really don't like the & in your URLs, I'd suggest to check the setting of arg_separator directive in your php.ini file, although I'm not 100% sure it influences the way how file_get_contents modifies the URLs