|
Posted by Erwin Moller on 10/02/07 11:34
Tim Arview wrote:
> 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>";
Hi,
Try curl_error() here to get a better errordesription.
Also, some proxies demand a username/password. Could this be the case?
> }
>
> 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.
>
> In researching the problem, I thought I was on to something when I
> read that the host could have a firewall in place to block
> connections. My host had, in fact, done this and required having a
> dedicated IP in order to bypass the firewall. I paid for the dedicated
> IP and now have it configured that way, but I'm still getting an
> error!
Talk with your ISP about this.
>
> Oh, BTW, I had it echo curl_getinfo( $ch, CURLINFO_HTTP_CODE ) in
> place of the error message, but all I got back was "0", which -
> obviously - is not a valid HTTP code.
>
> Any help you can provide will be appreciated. Feel free to respond via
> e-mail or the group, as I will be checking both frequently until this
> is resolved.
>
> Thanks in advance.
>
> Tim
>
Good luck.
Maybe you get luckier with curl_error().
Regards,
Erwin Moller
[Back to original message]
|