PDA

View Full Version : Still problems



Marckus_e
02-25-2004, 12:30 AM
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

I have now tried both IP and Name, no difference.

I can access it manually by entering the adress so the server is answering, i have tried the script from different machines also and same error!

Best Regards
Marcus Eklund

DirectAdmin Support
02-25-2004, 09:27 AM
Hello,

double check the values that you are passing that funtion, and double check it's usage:

http://www.php.net/manual/en/function.fsockopen.php

John

Marckus_e
02-25-2004, 09:47 AM
I am using the phpclass from l0rdphi.
and the i am using the example that should show all the users.

I will check again tomorrow but i have been trippelchecking all the info.

Best Regards
Marcus Eklund

l0rdphi1
02-25-2004, 11:05 AM
Odd. Can you paste the code you're using (minus password), along with the content of /etc/hosts (long shot) :)

Marckus_e
02-25-2004, 11:19 AM
Will do firstthing tomorrow when i get back to the job!

/Marcus

l0rdphi1
02-25-2004, 12:44 PM
Sounds good. :)

Marckus_e
02-27-2004, 12:08 AM
Hi!

I just checked my hosts on my machine
just 127.0.0.1 localhost

The code is the same as in
example.show_all_users.php

Except for the right login/password and adress to server

Best Regards
Marcus

Marckus_e
03-01-2004, 07:00 AM
<?php

include 'httpsocket.php';

$sock = new HTTPSocket;

$sock->connect('https://ipnumber',2222);
$sock->set_login('login','password');

$sock->query('/CMD_API_SHOW_ALL_USERS');
$result = $sock->fetch_parsed_body();

print_r($result);
print_r($sock->error);
?>

That is the code in example.show_all_users.php

and httpsocket.php is default.

except for

$fp = fsockopen( $this->remote_host, $this->remote_port, $sock_errno, $sock_errstr, 30 );

Line : 88

Best regards
Marcus

CyberAlien
03-01-2004, 07:16 AM
remove https:// from $sock->connect();

l0rdphi1
03-01-2004, 07:49 AM
Yeah, you can't connect to https streams unless you compile PHP with OpenSSL.

CyberAlien
03-01-2004, 07:55 AM
Even with SSL he can't use it. That parameter is passed directly to fsockopen(). fsockopen() doesn't parse urls - its usual socket connect function that uses ip/hostname to connect. So there should be no protocol at all - just ip or hostname. If you want to use SSL then use CURL instead of sockets.

l0rdphi1
03-01-2004, 08:02 AM
No, I'm pretty sure SSL will work with fsockopen. You must use ssl:// inplace of https:// though. Port 443, too.

CyberAlien
03-01-2004, 08:34 AM
I didn't know about that. Looks like that feature was added in php 4.3.0. Thanks for info.

Marckus_e
03-01-2004, 09:18 AM
I have tried with both SSL:// and nothing but the adress..

Doesn't work either way :/

/Marcus

l0rdphi1
03-01-2004, 11:08 AM
You don't have PHP configured with OpenSSL.

Marckus_e
03-01-2004, 01:08 PM
I have OpenSSL support enabled in PHP.

OpenSSL Version OpenSSL 0.9.7c 30 Sep 2003

/Marcus

ProWebUK
03-01-2004, 03:45 PM
phpinfo()

is --with-openssl in your configure line?

Also do you have OpenSSL in your SERVER_SOFTWARE section

Marckus_e
03-01-2004, 11:25 PM
Yes.

/Marcus

ProWebUK
03-02-2004, 04:12 AM
Looking at the error again, it appears the name your connecting to doesnt resolve...

Check that what your trying to connect to resolves ok (try a local and external ping / traceroute)

Chris

Marckus_e
03-02-2004, 04:17 AM
It resolves if i ping/traceroute.. i have tried from two different locations and the script doesn't work.. but it works fine if i go there manually..

/Marcus

ProWebUK
03-02-2004, 04:31 AM
$sock->connect('https://ipnumber',2222);

Since you're connecting through https:// i assume you have directadmin set to run under ssl?

Marckus_e
03-02-2004, 04:34 AM
Yes, it is ssl.

i have tried with ssl:// https:// and nothing before the ipnumber/hostname in the script and they give me the same error

/Marcus

Marckus_e
03-02-2004, 11:37 PM
Problem solved!
What solved the problem i don't know.

It works just fine now!

Thanks for the patient with me!

/Best regards
Marcus

l0rdphi1
03-03-2004, 04:32 AM
By the way, how did you get OpenSSL to compile into PHP? What operating system are you running? I was/am having a hell of a time trying to get it working under RH9.