Jump to content

connect to URL via proxy


randomsai

Recommended Posts

i need to connect to a URL in my application, via a proxy connection. it also uses authentication.

 

this is my code so far....does not work

 

<?php

$username = 'sastudents/807004261';

$password = '19880609';

$opts = array('http' => array('proxy' => 'HTTP://192.168.224.5:8080', 'request_fulluri' => true));

$context = stream_context_create(array(

    'http' => array(

        'header'  => "Authorization: Basic " . base64_encode("$username:$password")

    )

));

$data = file_get_contents('http://www.google.com', false, $context);

 

echo $data;

 

?>

 

 

Can anyone help me or tell me what the problem is???

Link to comment
https://forums.phpfreaks.com/topic/197274-connect-to-url-via-proxy/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.