09-25-2007, 01:42 AM
|
#2 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
I don't believe there's any way to add proxy support to the native file_get_contents(), but I've wrote you a function below, file_get_contents_proxy() that adds proxy support via the cURL library which will need to be enabled.
Note: Really tired so it may not even work :( ! Someone else will be able to help you from this if not.
PHP Code:
function file_get_contents_proxy($szURL, $szProxy, $iProxyPort = 8080) { $pCurl = curl_init($szURL); curl_setopt(CURLOPT_PROXY, $szProxy); curl_setopt(CURLOPT_PROXYPORT, $iProxyPort); curl_setopt(CURLOPT_FOLLOWLOCATION, true); curl_setopt(CURLOPT_RETURNTRANSFER, true); return curl_exec($pCurl); }
$szURL = 'http://www.google.com/'; $szProxy = 'myProxy.com';
file_get_contents_proxy($szURL, $szProxy);
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|