Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Random php5-curl problem

GaryGary Member
edited May 2012 in Help

I'm sure someone here can point me in the right direction. I'm having a little trouble with php5-curl. socks5 proxies don't seem to work.

The socks5 proxies I'm trying work find on the command line with curl actual. When using them inside php, no dice.

The following works:

<?php //$proxy = 'xxx.xxx.xxx.xxx:xxxxx'; $url = 'http://automation.whatismyip.com/n09230945.asp'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //curl_setopt($curl, CURLOPT_PROXY, $proxy); //curl_setopt($curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); echo curl_exec($curl); curl_close($curl); ?>

With the commented lines uncommented, nothing. It just hangs until it eventually times out.

`php prox.php

  • About to connect() to proxy xxx.xxx.xxx.xxx port xxxxx (#0)
  • Trying xxx.xxx.xxx.xxx... * connected
    `

Like I say, the proxy works A-OK with command line curl. :/

What could be wrong? Anyone experienced it before?

Comments

  • AsimAsim Member

    Seems an issue with socks 5, your code is working fine

    Thanked by 1Gary
  • php5-curl (well, libcurl) and cli curl versions match?

    Thanked by 1Gary
  • yomeroyomero Member

    I am trying with a SSH tunnel. Is working o_O

    Thanked by 1Gary
  • GaryGary Member

    curl --version curl 7.21.0 (i486-pc-linux-gnu) libcurl/7.21.0

    and from phpinfo:

    curl

    cURL support enabled
    cURL Information 7.21.0

    Buggered if I know what the problem is.

  • FRCoreyFRCorey Member

    Are you trying to write a script for dynamic dns?

  • GaryGary Member

    Nope.

  • 1q11q1 Member

    It seems that this is a name resolving issue. I think you should use local name server. Go install pdnsd and change your nameserver to 127.0.0.1

  • GaryGary Member

    Oh, thanks. :) I'll give that a go. Fingers crossed!

  • 1q11q1 Member

    How was it?

  • AsadAsad Member

    @Gary said: //$proxy = 'xxx.xxx.xxx.xxx:xxxxx';

    Is port xxxxx unblocked on the servers firewall for outgoing tcp connections?

  • GaryGary Member

    @1q1 - haven't had a chance to check, I'm busy on other projects right now.

    @ Asad - it works from the command line.

Sign In or Register to comment.