|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-10-25 22:42 UTC] tom at minnesota dot com
Demonstration that fsockopen() DOESN'T works using FQDN.
First I'll verify that my DNS works. This should eliminate
the blame on DNS:
# ping -c 5 www.php.net
PING www.php.net (208.247.106.187): 48 data bytes
64 bytes from 208.247.106.187: icmp_seq=0 ttl=244 time=78.557 ms
64 bytes from 208.247.106.187: icmp_seq=1 ttl=244 time=69.776 ms
64 bytes from 208.247.106.187: icmp_seq=2 ttl=244 time=71.729 ms
64 bytes from 208.247.106.187: icmp_seq=3 ttl=244 time=67.823 ms
64 bytes from 208.247.106.187: icmp_seq=4 ttl=244 time=68.800 ms
----www.php.net PING Statistics----
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 67.823/71.337/78.557/4.287 ms
---cut---
<?php
$fp = fsockopen ("www.php.net", 80, &$errno, &$errstr, 30);
if (!$fp) {
echo "Unable to open a socket using fsockopen<br>\n";
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
?>
---cut---
Demonstration that fopen() works using FQDN.
---cut---
<?php
$fp = fopen ("http://www.php.net/", "r");
if (!$fp) {
echo "Unable to open a socket using fopen()<br>\n";
echo "$errstr ($errno)<br>\n";
} else {
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
?>
---cut---
Demonstration that fsockopen() does works using IP address.
---cut---
<?php
$fp = fsockopen ("208.247.106.187", 80, &$errno, &$errstr, 30);
if (!$fp) {
echo "Unable to open a socket using fsockopen<br>\n";
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
?>
---cut---
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 20:00:01 2025 UTC |
that was on NetBSD/Alpha 1.5_BETA. Perhaps these lines from config.log may help: /usr/include/sys/socket.h:186: syntax error before `u_char' /usr/include/sys/socket.h:214: syntax error before `u_char' /usr/include/sys/socket.h:216: `int64_t' undeclared here (not in a function) /usr/include/sys/socket.h:216: `u_char' undeclared here (not in a function) /usr/include/sys/socket.h:216: size of array `__ss_pad1' is negative /usr/include/sys/socket.h:217: syntax error before `int64_t' /usr/include/sys/socket.h:218: `u_char' undeclared here (not in a function) /usr/include/sys/socket.h:218: `int64_t' undeclared here (not in a function) /usr/include/sys/socket.h:218: `u_char' undeclared here (not in a function) /usr/include/sys/socket.h:218: `int64_t' undeclared here (not in a function) /usr/include/sys/socket.h:273: syntax error before `uid_t' /usr/include/sys/socket.h:278: syntax error before `gid_t' /usr/include/sys/socket.h:452: syntax error before `u_short' /usr/include/sys/socket.h:460: syntax error before `caddr_t' /usr/include/sys/socket.h:464: syntax error before `caddr_t' /usr/include/sys/socket.h:485: syntax error before `recv' /usr/include/sys/socket.h:485: syntax error before `size_t' /usr/include/sys/socket.h:485: warning: data definition has no type or storage class /usr/include/sys/socket.h:486: syntax error before `recvfrom' /usr/include/sys/socket.h:486: syntax error before `size_t' /usr/include/sys/socket.h:487: warning: data definition has no type or storage class /usr/include/sys/socket.h:488: syntax error before `recvmsg' /usr/include/sys/socket.h:488: warning: data definition has no type or storage class /usr/include/sys/socket.h:489: syntax error before `send' /usr/include/sys/socket.h:489: syntax error before `size_t' /usr/include/sys/socket.h:489: warning: data definition has no type or storage class /usr/include/sys/socket.h:490: syntax error before `sendto' /usr/include/sys/socket.h:491: syntax error before `size_t' /usr/include/sys/socket.h:491: warning: data definition has no type or storage class /usr/include/sys/socket.h:492: syntax error before `sendmsg' /usr/include/sys/socket.h:492: warning: data definition has no type or storage class In file included from configure:6052: /usr/include/netinet/in.h:124: syntax error before `u_int32_t' /usr/include/netinet/in.h:196: syntax error before `u_int8_t' /usr/include/netinet/in.h:200: syntax error before `int8_t' /usr/include/netinet/in.h:214: syntax error before `int8_t' In file included from /usr/include/netinet/in.h:376, from configure:6052: /usr/include/netinet6/in6.h:120: syntax error before `u_int8_t' /usr/include/netinet6/in6.h:142: syntax error before `u_int8_t' /usr/include/netinet6/in6.h:147: syntax error before `u_int32_t' /usr/include/netinet6/in6.h:594: syntax error before `*' /usr/include/netinet6/in6.h:596: syntax error before `*' /usr/include/netinet6/in6.h:596: warning: data definition has no type or storage class /usr/include/netinet6/in6.h:597: syntax error before `u_int8_t' /usr/include/netinet6/in6.h:598: syntax error before `u_int8_t' /usr/include/netinet6/in6.h:600: syntax error before `inet6_rthdr_space' /usr/include/netinet6/in6.h:600: warning: data definition has no type or storage class configure: failed program was: #line 6050 "configure" #include "confdefs.h" #include <sys/socket.h> #include <netinet/in.h> int main() { struct sockaddr_in6 s; s; ; return 0; }