i had same problem not 2 long ago
i read the manual and figured it out
http://www.php.net/manual/en/wrappers.http.php
http://www.php.net/manual/en/function.stre...text-create.php
http://www.php.net/manual/en/function.fopen.php
if you look at those 3 pages from the manual you can form this example:
at the same time i was looking how to connect through proxy i was looking how to send a cookie aswell so if you want cookie its in example also
<?php
$contextz['http']['proxy'] = "tcp://localhost:5865";
$contextz['http']['header'] = "Cookie: bla=123"; //if you want you can throw some cookies this way
$contextz = stream_context_create($contextz);
$filehandle = fopen("http://localhost/index.php", "r", false, $contextz);
?>
and there you are enjoy.