Date: 06/28/02
- Next message: derick <email protected>: "[PHP-DOC] Bug #8128 Updated: more descriptive parse error reports"
- Previous message: derick <email protected>: "[PHP-DOC] Bug #15714 Updated: Variables from outside PHP page doesn't mention new $_* arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 14663
Updated by: derick <email protected>
Reported By: aragon <email protected>
-Status: Suspended
+Status: Open
Bug Type: Documentation problem
Operating System: Windows NT 4 sp 6a
PHP Version: 4.1.0
New Comment:
No longer experimental
Previous Comments:
------------------------------------------------------------------------
[2002-02-06 12:44:59] alindeman <email protected>
status -> suspended (waiting till it becomes un-experimental ;)
------------------------------------------------------------------------
[2002-02-06 12:43:52] alindeman <email protected>
status -> suspended (waiting till it becomes un-experimental ;)
------------------------------------------------------------------------
[2001-12-22 16:22:10] jan <email protected>
the manual page is marked as "EXPERIMENTAL". so waiting for the
extension to become stable wil be the best. fixing the example now just
to change it again tomorrow is useless.
------------------------------------------------------------------------
[2001-12-22 15:58:12] mfischer <email protected>
Making a documentation problem. Valid sample still have to be written.
------------------------------------------------------------------------
[2001-12-22 15:50:49] aragon <email protected>
Example code copy/pasted from
http://www.php.net/manual/en/html/ref.sockets.html :
<?php
error_reporting (E_ALL);
echo "<h2>TCP/IP Connection</h2>\n";
/* Get the port for the WWW service. */
$service_port = getservbyname ('www', 'tcp');
/* Get the IP address for the target host. */
$address = gethostbyname ('www.php.net');
/* Create a TCP/IP socket. */
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket < 0) {
echo "socket_create() failed: reason: " . socket_strerror ($socket)
. "\n";
} else {
"socket_create() successful: " . socket_strerror ($socket) . "\n";
}
echo "Attempting to connect to '$address' on port '$service_port'...";
$result = socket_connect ($socket, $address, $service_port);
if ($result < 0) {
echo "socket_connect() failed.\nReason: ($result) " .
socket_strerror($result) . "\n";
} else {
echo "OK.\n";
}
$in = "HEAD / HTTP/1.0\r\n\r\n";
$out = '';
echo "Sending HTTP HEAD request...";
socket_write ($socket, $in, strlen ($in));
echo "OK.\n";
echo "Reading response:\n\n";
while (socket_read ($socket, $out, 2048)) {
echo $out;
}
echo "Closing socket...";
socket_close ($socket);
echo "OK.\n\n";
?>
When run :
<h2>TCP/IP Connection</h2>
<br>
<b>Warning</b>: socket_strerror() expects parameter 1 to be long,
resource given in <b>/usr/home/aragon/squeakbot/test2</b> on line
<b>18</b><br>
Attempting to connect to '209.61.157.217' on port '80'...OK.
Sending HTTP HEAD request...OK.
Reading response:
<br>
<b>Warning</b>: socket_read() expects parameter 2 to be long, string
given in <b>/usr/home/aragon/squeakbot/test2</b> on line <b>38</b><br>
Closing socket...OK.
Regards,
Aragon
------------------------------------------------------------------------
-- Edit this bug report at http://bugs.php.net/?id=14663&edit=1-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: derick <email protected>: "[PHP-DOC] Bug #8128 Updated: more descriptive parse error reports"
- Previous message: derick <email protected>: "[PHP-DOC] Bug #15714 Updated: Variables from outside PHP page doesn't mention new $_* arrays"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

