472,096 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

Problem with fsockopen()

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
9 18488
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
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
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
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
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
<?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
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
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
Undeliverable ;)

Thanks for your help, Steve!
It works ;)

Oct 14 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Colin Bell | last post: by
2 posts views Thread by Loopy | last post: by
6 posts views Thread by murd | last post: by
1 post views Thread by Syl | last post: by
15 posts views Thread by Bob Bedford | last post: by
8 posts views Thread by Yoko | last post: by
4 posts views Thread by keychain | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.