Proxy Authentication [Resolved]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
thomas777neo
Forum Contributor
Posts: 214
Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa

Proxy Authentication [Resolved]

Post by thomas777neo »

Hi All

I have a php script that runs on a server that connects through a proxy to access the net.

My problem is that I need to authenticate to the proxy server before I can do anything.

Here is a snippet of the code that fails due to the non-proxy authentication:

Code: Select all

$lines = file("http://www.xyz.co.za/incsms/sms_msgs.txt");
What can I do to have my script authenticate to the proxy server first?

Any help would be great. Thanks.

Edit:
I used this class found at

http://snoopy.sourceforge.net/

Just included the class, filled in the proxy settings. And it worked !!!

Thanks to anybody who started investigating the issue
eXpertPHP
Forum Newbie
Posts: 5
Joined: Sun Mar 12, 2006 9:11 am
Contact:

Post by eXpertPHP »

Code: Select all

$vcontext = array('http' => array('proxy' => 'tcp://127.0.0.1:8080', 'request_fulluri' => true));
$resource = stream_context_create($vcontext);
$lines = file("http://www.xyz.co.za/incsms/sms_msgs.txt", false, $resource);
Post Reply