0

I'm trying to use xml rpc in remote server.

using codeigniter xml-rpc class.

the xml rpc server didn't send any data. so i tracked the library

and reached to here

- parameters


THIS->SERVER : 10.222.223.53
THIS->PORT : 80
THIS->errno : 
THIS->errstr : 
THIS->timeout : 5

these are the parameters and in here,

$fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstring, 
 $this->timeout);

it returns FALSE, which means connection fail.

what should be the reason of this?

i checked 80 port is open with

this command

netstat -lntp

tcp 0 0 :::80 :::* LISTEN 6712/httpd

user1765884
  • 105
  • 1
  • 4
  • 13
  • If you remove the `@` before `fsockopen` you will get more info on the error. – bbonev Jul 18 '13 at 02:56
  • how can i check the err info after deleting it?? – user1765884 Jul 18 '13 at 03:00
  • It will most probably be printed in your script's output. Also there is a better way - print $this->errno and $this->errstr after the call of the function. – bbonev Jul 18 '13 at 03:06
  • Looks like I didn't explain what I mean - by removeing the `@` any warnings/errors by the function will be printed. – bbonev Jul 18 '13 at 03:15
  • ok so i got this! THIS->errno : 110 THIS->errstr : Connection timed out. what will be the next step... – user1765884 Jul 18 '13 at 03:50
  • This is not a problem with your code - this error means that the connection to host `10.222.223.53` cannot be established in reasonable time. `netstat` will show that a service listens on a port but cannot show if connection can be made. You can test with `telnet 10.222.223.53 80` – bbonev Jul 18 '13 at 03:54
  • Thanks man. the problem was the server's firewall gotcha! – user1765884 Jul 18 '13 at 06:33

1 Answers1

0

As discussed in comments the problem is not in the code but in lack of connectivity. A firewall in the particular case.

To more easily debug the issue there are two approaches:

  • remove the @ that is suppressing warning/error output from the fsockopen
  • inspect the values of $this->errno and $this->errstr after the call failed
bbonev
  • 1,406
  • 2
  • 16
  • 33