By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,630 Members | 1,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,630 IT Pros & Developers. It's quick & easy.

Problem with fsockopen()

P: n/a
Hi!

I have very big problem with fsockopen() function. It is very
important...

That's code:

<?php
$test = fsockopen ('chrome.pl', '8080');
?>

And that's result:

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: Temporary failure in name resolution in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 2

Warning: fsockopen() [function.fsockopen]: unable to connect to
chrome.pl:8080 (Unknown error) in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 2

I'm working on Linux Ubuntu 5.04 with Apache 2 (from package) and PHP5
(from package too).

I never use fsockopen(), so I'm absolutely "white"...

Please help me, the sooner the better, because script is very, very
important...

Best Regards,
Fipaj

Oct 11 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
fi*******@gmail.com wrote:
Hi!

I have very big problem with fsockopen() function. It is very
important...

That's code:

<?php
$test = fsockopen ('chrome.pl', '8080');
?>

And that's result:

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: Temporary failure in name resolution in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 2

Warning: fsockopen() [function.fsockopen]: unable to connect to
chrome.pl:8080 (Unknown error) in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 2

I'm working on Linux Ubuntu 5.04 with Apache 2 (from package) and PHP5
(from package too).

I never use fsockopen(), so I'm absolutely "white"...

Please help me, the sooner the better, because script is very, very
important...

Best Regards,
Fipaj

Hi,
AFAIK the first parameter of the fsockopen function means the
target/host you want to connect to. Nonetheless in this case chrome.pl
is not a host. Due to this, the PHP interpreter ist not able to
establish a connection and you get the error. If chrome.pl is a host,
write it like http://www.chrome.pl.

best regards

Nico
Oct 11 '05 #2

P: n/a
fi*******@gmail.com wrote:
Hi!

I have very big problem with fsockopen() function. It is very
important...

That's code:

<?php
$test = fsockopen ('chrome.pl', '8080');
?>

And that's result:

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: Temporary failure in name resolution in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 2

Warning: fsockopen() [function.fsockopen]: unable to connect to
chrome.pl:8080 (Unknown error) in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 2

I'm working on Linux Ubuntu 5.04 with Apache 2 (from package) and PHP5
(from package too).

I never use fsockopen(), so I'm absolutely "white"...

Please help me, the sooner the better, because script is very, very
important...

Best Regards,
Fipaj


Fipaj,

FWIW,

telnet chrome.pl 8080

also fails. It seems port 8080 is not open on that server.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 11 '05 #3

P: n/a
Thanks for answers.

But I have one more problem.

Result of this script:
Warning: fsockopen() [function.fsockopen]: unable to connect to
http://chrome.pl:8080 (Unable to find the socket transport "http" - did
you forget to enable it when you configured PHP?) in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 2

"Unable to find the socket transport "http" - did you forget to enable
it when you configured PHP?" - I have PHP compiled from .deb package.
I edit php.ini, but there's no any conf options for fsockopen(). How to
"destroy" this error (:>) and run script?

Best regards,
Fipaj

Oct 12 '05 #4

P: n/a
fi*******@gmail.com wrote:
Thanks for answers.

But I have one more problem.

Result of this script:
Warning: fsockopen() [function.fsockopen]: unable to connect to
http://chrome.pl:8080 (Unable to find the socket transport "http" - did
you forget to enable it when you configured PHP?) in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 2

"Unable to find the socket transport "http" - did you forget to enable
it when you configured PHP?" - I have PHP compiled from .deb package.
I edit php.ini, but there's no any conf options for fsockopen(). How to
"destroy" this error (:>) and run script?

Best regards,
Fipaj

Hi,
I'm sorry, but I just noticed that I've made a mistake in my answer.
HTTP ist based on the TCP/IP protocol and it is forbidden to define
http://chrome.pl as host. Do you want to connect to the website
www.chrome.pl on port 8080? Then you only have to write www.chrome.pl as
host name in your script. If my assumption is wrong, please concretise
your question.

best regards,
nico
Oct 12 '05 #5

P: n/a
Thanks Nico.

But I'm not right, because I have some inner problem...

I need to connect with port 5222 (XMPP [jabber]), not 8080...

<?php
$test = fsockopen ('http://chrome.pl', '5222');
?>

But result is the same ;)

At the end, sorry for my bad English, I'm learning ;)

Best Regards,
Fipaj

Oct 12 '05 #6

P: n/a
<?php
$test = fsockopen ('http://chrome.pl', '5222');
?>


So nearly there... try this:

$test = fsockopen( 'chrome.pl', '5222' );
fwrite( $test, '<?xml version="1.0"?><stream:stream
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"
to="nastysoft.com">' );
print fread( $test, 1024 );
fclose( $test );

Server returns:

<?xml version='1.0'?><stream:stream
xmlns:stream='http://etherx.jabber.org/streams' id='434D8128'
xmlns='jabber:client' from='nastysoft.com'>

Lookin' good...

---
Steve

Oct 12 '05 #7

P: n/a
Steve:
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: Temporary failure in name resolution in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 5

Warning: fsockopen() [function.fsockopen]: unable to connect to
chrome.pl:5222 (Unknown error) in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 5

Warning: fwrite(): supplied argument is not a valid stream resource in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 8

Warning: fread(): supplied argument is not a valid stream resource in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 9

Warning: fclose(): supplied argument is not a valid stream resource in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php

I'm sure that something is wrong with my server/php configuration. But
what?

PS.

Script:
<?php
$fp = fsockopen("www.chrome.pl", 8080, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
}
?>

Result:
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: Temporary failure in name resolution in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 2

Warning: fsockopen() [function.fsockopen]: unable to connect to
www.chrome.pl:8080 (Unknown error) in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 2
(-1213682620)

Oct 13 '05 #8

P: n/a
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: Temporary failure in name resolution in
/home/fipaj/serwer/works/jabber-php/class_jabber_php-0.4.2/test1.php on
line 5


Your DNS service is kaput. Substitute the IP...

$test = fsockopen('217.173.160.48', '5222'); // chrome.pl

---
Steve

Oct 13 '05 #9

P: n/a
Undeliverable ;)

Thanks for your help, Steve!
It works ;)

Oct 14 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.