Jump to content
php.lv forumi

Fsockopen()


PoRToSS

Recommended Posts

Panjeemu no php.net sorsi:

<code><font color="#000000">

<font color="#0000CC"><?php
$fp </font><font color="#006600">= </font><font color="#0000CC">fsockopen </font><font color="#006600">(</font><font color="#CC0000">"www.delfi.lv"</font><font color="#006600">, </font><font color="#0000CC">80</font><font color="#006600">, </font><font color="#0000CC">$errno</font><font color="#006600">, </font><font color="#0000CC">$errstr</font><font color="#006600">, </font><font color="#0000CC">30</font><font color="#006600">);
if (!</font><font color="#0000CC">$fp</font><font color="#006600">) {
echo </font><font color="#CC0000">"$errstr ($errno)
n"</font><font color="#006600">;
} else {
</font><font color="#0000CC">fputs </font><font color="#006600">(</font><font color="#0000CC">$fp</font><font color="#006600">, </font><font color="#CC0000">"GET / HTTP/1.0rnHost: www.delfi.lvrnrn"</font><font color="#006600">);
while (!</font><font color="#0000CC">[url=http://lv.php.net/feof]feof[/url]</font><font color="#006600">(</font><font color="#0000CC">$fp</font><font color="#006600">)) {
	echo </font><font color="#0000CC">fgets </font><font color="#006600">(</font><font color="#0000CC">$fp</font><font color="#006600">,</font><font color="#0000CC">128</font><font color="#006600">);
}
</font><font color="#0000CC">fclose </font><font color="#006600">(</font><font color="#0000CC">$fp</font><font color="#006600">);
}
</font><font color="#0000CC">?>
</font>
</font>
</code>

Izmet sekojoshus errorus:

 

Warning: fsockopen(): php_network_getaddresses: gethostbyname failed in D:UsersApacheApache2htdocscountergen_bilde.php on line 4

 

Warning: fsockopen(): unable to connect to http://www.delfi.lv:80 in D:UsersApacheApache2htdocscountergen_bilde.php on line 4

The operation completed successfully. (0)

 

Kaadeelj taa?

Link to comment
Share on other sites

×
×
  • Create New...