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
The problem is most likely part of your PHP code. I suspect that what you think is happening is not actually happening.
I suspect that rather than the code you posted, you are probably grabbing part of that URL from a variable, such as:
$data = file_get_contents("http://example.com/?$myvariable");
Echoing that variable to the browser may be hiding the fact that you've inadvertently encoded special characters in a previous step, because in the browser an "&" is going to look like "&".
It's also possible that your file_get_contents() request is working correctly, and what you think is a problem with encoding the & sign may be a problem somewhere else - posting actual source code might help determining the problem.