proxy setting

Help
2005-02-27
2013-05-30
  • cmixolydian
    cmixolydian
    2005-02-27

    Hi, I am converting my command line Perl script to online PHP script that is using Snoopy. However, my proxy setting doesn't seem to work with the PHP script, although it works with the Perl script. Here are the PHP lines I use:

    <?php
        require_once "Snoopy.class.php";
       
        $snoopy = new Snoopy();
        $snoopy->$proxy_host = "proxy.mydomain.edu.sg";
        $snoopy->$proxy_port = "8080";
       
        $snoopy->fetch("http://www.google.com.sg");
        print $snoopy->results;
    ?>

    The error is this:
    Warning: fsockopen(): unable to connect to www.google.com.sg:80 in /Library/PHP4/lib/php/Snoopy.class.php on line 1126

    (the PHP script works well when given URL of intranet page, btw)

    My Perl scripts use this:
    ...
    my $browser = LWP::UserAgent->new;
    $browser->proxy('http', 'http://proxy.mydomain.edu.sg');
    my $response = $browser->get($url);
    ....

    What did I do wrong? :s I believe I set the proxy settings correctly