DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Add Proxy Context Stream For PHP

01.17.2011
| 3016 views |
  • submit to reddit
        // description of your code here


$url = 'http://www';
     
     $proxy = 'tcp://xxx:8080';
     
     $context = array(
     	'http' => array(
     		'proxy' => $proxy,
     		'request_fulluri' => True,
     		),
    	);
    	
    $context = stream_context_create($context);
    
    $body = file_get_contents($url, False, $context);