Over a million developers have joined DZone.

Add Proxy Context Stream For PHP

·
// 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);

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}