ID: 26016
Updated by: pollita@php.net
Reported By: hill at bluecarrots dot com
Status: Wont fix
Bug Type: *General Issues
Operating System: Linux
PHP Version: 4.3.3
New Comment:
I can see the confusion and will take a look at rewording some of the
documentation.
http://, ftp://, gopher://, nntp://, etc... These all
describe
application layer protocols (known in PHP as wrappers).
See Also: http://www.php.net/wrappers
tcp://, udp://, unix://, udg://, ssl://, tls://, etc... describe
network layer protocols (also referred to as socket transports).
See Also: http://www.php.net/transports
fopen() (and family) work with wrappers, while fsockopen() only works
with transports.
When you use fopen('http://...', 'r') to open a
remote resource URL.
PHP creates a socket connection to the specified host and caries on an
entire conversation with the remote server (asking for a specific
document, passing authentication parameters, user-agent, negotiating
content encoding, etc...).
When you use fsockopen('tcp://hostname', 80) to open a connection to a
remote listener, PHP creates the socket connection as before, but then
stops, leaving the matter of application layer communication up to your
script.
If you're interrested in more detail, google for "ISO Model" and read
up about the differences between the layers.
Previous Comments:
------------------------------------------------------------------------
[2004-07-19 20:40:40] wmueller at email dot com
well little stupid me! i would recommend then to strip all the comments
in the docs that contain resource url's instead of hostnames :-p
for some reason i think it is like making jokes. udp:// is oke, ssl://
yes, http:// makes it a 'thing'... i might use tcp:// instead as
http
is unknown to fsockopen? ok at least windows understands me...
ok i am just picking the details now ;)
thanks for clearify that!! please make a note into the manuals! :-)
------------------------------------------------------------------------
[2004-07-18 21:04:48] pollita@php.net
http://www.webseite.com is not a hostname.
http://www.webseite.com is a remote resource URL.
www.webseite.com is a hostname.
You are using the function incorrectly.
------------------------------------------------------------------------
[2004-07-18 11:16:46] wez@php.net
--disable-ipv6 when you configure.
------------------------------------------------------------------------
[2004-07-18 01:38:15] wmueller at email dot com
well there must be more than just forgotten ssl support.
i have php compiled with: '--with-openssl' and still if i do a
fsockopen i end up with no socket AND a success message. if this is not
a bug what else would be one?
i do:
$fp = fsockopen("http://www.webseite.com",
80, $errno, $errstr, 4);
if(!$fp){
// this will echo the errorno: 0 and success message :p
echo "$errstr ($errno)<br />\n";
}else{
// stuff
}
Script output:
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: Name or service not known in /www/htdocs/.... on
line ...
Warning: fsockopen() [function.fsockopen]: unable to connect to
http://www.website.com:80 in /www/htdocs/.... on line ...
Success (0)
System is a Suse Linux / PHP 4.3.1
same script works on windows
and no i do not upgrade to php5 just for the taste of it :p
so me too would vote for a fix!
any comments welcome. thanks for doing php(4) :-)
------------------------------------------------------------------------
[2004-06-16 16:39:23] pollita@php.net
It's a "Won't fix" for PHP4 because it requires a *significant* rewrite
of the socket transport layer. As any responsible developer knows, you
don't make massive changes to a stable branch of code, that's how you
introduce bugs. You don't want bugs do you?
It's also a "Won't fix" because it does work in PHP4 if you simply
follow the instructions:
For Linux: Compile OpenSSL support in staticly rather than as a shared
module. ./configure --with-openssl rather than ./configure
--with-openssl=shared
For Windows: Use the alternate php4libts.dll provided at
http://ftp.proventum.net/pub/php/win32/misc/openssl/
Creating a drama out of being "forced" to move to PHP5 to get ssl
sockets to work seems...well... childish is a good word isn't it?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/26016
--
Edit this bug report at http://bugs.php.net/?id=26016&edit=1