file_get_contents snippets

How to use file_get_contents with a proxy

Tagged file_get_contents, proxy  Languages php
$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);

The code was found here. Note that it doesn't seem to work with HTTPS.