Reply to Re: HTTP request with proxy

Your name:

Reply:


Posted by Manuel Lemos on 10/04/07 00:05

Hello,

on 10/02/2007 12:10 AM Tim Arview said the following:
> Hello,
>
> I am working on a project to access a web page through a proxy. I do
> not host the script myself, but upload it to my hosting provider. The
> version of PHP on that server is 4.4.6.
>
> I have attempted using fsockopen as well as cURL to accomplish this
> task, but it won't seem to work. Here is the important bits of the
> code I am using:
>
> $ch = curl_init();
> curl_setopt( $ch, CURLOPT_HTTPPROXYTUNNEL, 1 );
> curl_setopt( $ch, CURLOPT_PROXY, $proxy . ":" . $port );
> curl_setopt( $ch, CURLOPT_URL, $url );
> curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
> curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
> if( !curl_exec( $ch ) ) {
> echo "<font color=red>Error</font>";
> }
>
> I can't understand why it doesn't work, but all I ever get back is the
> error. I have tried several proxies and ports, and they all return the
> same message.

Maybe the proxy requires authentication.

You may want to take a look at this HTTP client class. It supports
proxies and authentication too. If you still have a problem, at least
the class can output debug information with the HTTP dialog so you can
see why it fails:

http://www.phpclasses.org/httpclient


--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация