בעיות בפתיחת SOCKET

ditsia

New member
בעיות בפתיחת SOCKET

שלום לכולם!! אני עדיין לא הצלחתי לפתוח SOCKET.
הקוד שכתבתי:
<?php $fp = fsockopen("http://computerbasics.eitan.ac.il", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "GET / HTTP/1.1\r\n"; $out .= "Host: http://computerbasics.eitan.ac.il\r\n"; $out .= "Connection: Close\r\n\r\n"; fputs($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp); } ?>​
ה- ERROR שקיבלתי: Warning: fsockopen(): php_network_getaddresses: gethostbyname failed in c:\inetpub\wwwroot\first.php on line 2 Warning: fsockopen(): unable to connect to http://computerbasics.eitan.ac.il:80 in c:\inetpub\wwwroot\first.php on line 2 The operation completed successfully. (0) ERROR נוסף שקיבלתי כששיניתי את כתובת ה-TARGET נראה כך: Warning: fsockopen(): php_network_getaddresses: gethostbyname failed in c:\inetpub\wwwroot\first.php on line 2 Warning: fsockopen(): unable to connect to http://www.eged.co.il:80 in c:\inetpub\wwwroot\first.php on line 2 The operation completed successfully. (0) אם למישהו יש רעיון מה הגורם?? איך לפתור את זה? אני ממש אשמח
נ.ב: ניסיתי להציב ב-STRING TARGET כתובות שונות וכל הזמן קיבלתי את שני ה-ERRORS
 

kensaggy

New member
מממממ....

הבעיה אינה בקוד. הבעיה היא שהשרתים שאליהם את מנסה להתחבר חסמו את האפשרות הזאת. נסי לשנות את הכתובת ל example.com או yahoo.com ותראי שזה עובד יופי
(בדוק) אם את רוצה רק להשיג את קוד המקור של האתרים הללו נסי להשתמש ב fopen או file לצורך העניין... בהצלחה, חן.
 
http?

נסה ללא http:// אתה נכשל על gethostbyname - כלומר המחשב לא יודע איך לתרגם את "http://computer..." לכתובת IP.
 
למעלה