|
Posted by Tim Arview on 10/02/07 03:10
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.
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!
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
[Back to original message]
|