RESOLVED-Accessing site via a proxy server with PHP file_get_contents
Hi Guys,
Looking for an answer to this isse that's had me going around in circles for 2 days and now I'm at a brick wall. There are number of resources that purport to have the solution but they all look like they copied the same script so i am now not convinced it is correct.
Hereis the short test script I have used to test this but I get the following error.
Warning: file_get_contents(The AA: Breakdown Cover, Car Insurance, Home Insurance, Loans, Motoring Advice, Travel and Maps) [function.file-get-contents]: failed to open stream: Connection timed out in /home5/XXXXXXXX/public_html/mkm/tools/test.php on line 11
The script is:
_____________
<?php
function file_get_contents_proxy($url,$proxy){
// Create context stream
$context_array = array('http'=>array('proxy'=>$proxy,'request_fullu ri'=>true));
$context = stream_context_create($context_array);
// Use context stream with file_get_contents
$data = file_get_contents($url,false,$context);
// Return data via proxy
return $data;
}
$url = "http://www.theaa.com";
$proxy = "tcp://132.254.101.52:3128";
file_get_contents_proxy($url,$proxy);
Echo $data
?>
________
$url is an arbitary wesite
$proxy is a randomly chosen public proxy that I have tested both with an online checker and by adding it to my browser config.
If I just use the file_get_contents I can access the file directly but I cannot access it via the proxy.
Anyone familiar with accessing sites/site files via a proxy server?
Really appreciate your help
Will definitely find some kind of "reward" for anyone who gives me the solution.
Or tell me how much

Thanks
Tony
-
KirkMcD -
Thanks - 1 reply
{{ DiscussionBoard.errors[3812289].message }}-
Tony Marriott -
Thanks - 1 reply
SignatureFree Local Business Analyzer & Lead Generator{{ DiscussionBoard.errors[3812596].message }}-
KirkMcD -
[ 1 ] Thanks - 2 replies
{{ DiscussionBoard.errors[3816303].message }}-
Tony Marriott -
Thanks - 1 reply
SignatureFree Local Business Analyzer & Lead Generator{{ DiscussionBoard.errors[3818525].message }}-
spamfighter -
Thanks - 1 reply
{{ DiscussionBoard.errors[3829838].message }}-
Tony Marriott -
Thanks
SignatureFree Local Business Analyzer & Lead Generator{{ DiscussionBoard.errors[3857075].message }} -
-
-
-
Tony Marriott -
Thanks
SignatureFree Local Business Analyzer & Lead Generator{{ DiscussionBoard.errors[3857096].message }} -
-
-
-
-
wayfarer -
Thanks - 1 reply
SignatureI build web things, server things. I help build the startup Veenome. | Remote Programming Jobs{{ DiscussionBoard.errors[3812712].message }}-
Tony Marriott -
Thanks
SignatureFree Local Business Analyzer & Lead Generator{{ DiscussionBoard.errors[3812919].message }} -
-
-
wayfarer -
Thanks - 1 reply
SignatureI build web things, server things. I help build the startup Veenome. | Remote Programming Jobs{{ DiscussionBoard.errors[3858032].message }}-
Tony Marriott -
Thanks - 1 reply
SignatureFree Local Business Analyzer & Lead Generator{{ DiscussionBoard.errors[3859873].message }}-
Tony Marriott -
Thanks
SignatureFree Local Business Analyzer & Lead Generator{{ DiscussionBoard.errors[3901077].message }} -
-
-