Page 1 of 1

cURL and IP Addresses

Posted: Wed Apr 29, 2009 5:25 am
by ben91082
Hello,

I am having trouble posting form data to a remote script using cURL where the script is located via an IP address. This is what I'm trying to do which is currently not working:

Code: Select all

 
$url = "http://xxx.xxx.xx.xxx:xxx/scripts/myscript.py";
$args = "username=".urlencode($user['username']);
 
                         $ch = curl_init();
 
                         curl_setopt($ch, CURLOPT_URL,$url);
                         curl_setopt($ch, CURLOPT_POST, 1);
                         curl_setopt($ch, CURLOPT_POSTFIELDS,$args);
                         $result= curl_exec ($ch);
                         curl_close ($ch);
However if I try a similar thing with an actual domain name, i.e same code as above but change $url to http://www.mydomain.com/scripts/myscript.py it works fine. Any ideas why this might not be working?

Thanks.

Re: cURL and IP Addresses

Posted: Thu Apr 30, 2009 2:03 pm
by Christopher
Can you access http://xxx.xxx.xx.xxx:xxx/scripts/myscript.py directly? I notice you have a port number in there. Is it 80?