לא מצליח ליצור אובייקטים-כנראה
יש לי PWS וביצעתי התקנה של PHP שאמורה להיות מותאמת אליו מערכת הפעלה חלונות (כמובן). ניסיתי לעבוד עם פונקציות SOCKET ואני מקבל שגיאות. צרפתי כאן את השגיאה וקוד המקור (שלקוח מהאתר של PHP) מישהו יכול להגיד לי מה סיבת השגיאה ואיך טני מתגבר על הבעיה? בברכה. the error: =============================== TCP/IP Connection Fatal error: Call to undefined function: socket_create() in C:\Inetpub\wwwroot\php2\default.php on line 13 the script code: ================================ <?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"; ?>
יש לי PWS וביצעתי התקנה של PHP שאמורה להיות מותאמת אליו מערכת הפעלה חלונות (כמובן). ניסיתי לעבוד עם פונקציות SOCKET ואני מקבל שגיאות. צרפתי כאן את השגיאה וקוד המקור (שלקוח מהאתר של PHP) מישהו יכול להגיד לי מה סיבת השגיאה ואיך טני מתגבר על הבעיה? בברכה. the error: =============================== TCP/IP Connection Fatal error: Call to undefined function: socket_create() in C:\Inetpub\wwwroot\php2\default.php on line 13 the script code: ================================ <?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"; ?>