cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Problems using proxy with cURL

From: Centjes <centjes_at_centjes.net>
Date: Sat, 16 Sep 2006 11:39:17 +0200

Hi,

Configuration info: PHP Version 4.4.0 & libcurl/7.11.2

I've written a simple script testing how to use proxies with cURL.

I don't know what's wrong with the code but I receive a blank page when I run it.

Here is the code:

<?
    $cURL = curl_init();
    curl_setopt($cURL, CURLOPT_URL, "http://www.google.com");
    curl_setopt($cURL, CURLOPT_HEADER, 1);
    curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($cURL, CURLOPT_HTTPPROXYTUNNEL, 1);
    curl_setopt($cURL, CURLOPT_PROXY, "128.31.1.14:3128");
    $strPage = curl_exec($cURL);
    curl_close($cURL);
    echo($strPage);
?>

If I comment the lines

    curl_setopt($cURL, CURLOPT_HTTPPROXYTUNNEL, 1);
    curl_setopt($cURL, CURLOPT_PROXY, "128.31.1.14:3128");

Then it's working fine.

Hope you can help me.

Thanks in advance,
Centjes

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-09-16