Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem with fsockopen()

fipaj1992@gmail.com
Guest
 
Posts: n/a
#1: Oct 11 '05
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


Nico Busch
Guest
 
Posts: n/a
#2: Oct 11 '05

re: Problem with fsockopen()


fipaj1992@gmail.com wrote:[color=blue]
> 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
>[/color]


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
Jerry Stuckle
Guest
 
Posts: n/a
#3: Oct 11 '05

re: Problem with fsockopen()


fipaj1992@gmail.com wrote:[color=blue]
> 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
>[/color]

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.
jstucklex@attglobal.net
==================
fipaj1992@gmail.com
Guest
 
Posts: n/a
#4: Oct 12 '05

re: Problem with fsockopen()


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

Nico Busch
Guest
 
Posts: n/a
#5: Oct 12 '05

re: Problem with fsockopen()


fipaj1992@gmail.com wrote:[color=blue]
> 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
>[/color]


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
fipaj1992@gmail.com
Guest
 
Posts: n/a
#6: Oct 12 '05

re: Problem with fsockopen()


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

Steve
Guest
 
Posts: n/a
#7: Oct 12 '05

re: Problem with fsockopen()


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

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

fipaj1992@gmail.com
Guest
 
Posts: n/a
#8: Oct 13 '05

re: Problem with fsockopen()


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)

Steve
Guest
 
Posts: n/a
#9: Oct 13 '05

re: Problem with fsockopen()


[color=blue]
> 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[/color]

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

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

---
Steve

fipaj1992@gmail.com
Guest
 
Posts: n/a
#10: Oct 14 '05

re: Problem with fsockopen()


Undeliverable ;)

Thanks for your help, Steve!
It works ;)

Closed Thread