SkaKri Posted June 12, 2006 Report Share Posted June 12, 2006 ir kāda f-cija kas pārbauda vai ports ir 0/1 un vai serveris ironline/offline (tur tak ar fopen neizbraukt)? paldies. koda gabalus nevajag. Link to comment Share on other sites More sharing options...
Vebers Posted June 12, 2006 Report Share Posted June 12, 2006 Ar soketiem atver pieslēgumu uz dotoserveri un apskaties. http://lv.php.net/fsockopen Link to comment Share on other sites More sharing options...
SkaKri Posted June 12, 2006 Author Report Share Posted June 12, 2006 <?php $fp = fsockopen("www.example.com", 8000, $errno, $errstr, 30); if (!$fp) { echo "offline<br />\n"; } else { echo "online<br />\n"; } ?> un viss? izskatās pārāk vienkārši, lai būtu pareizi. pābaudīsim.. Link to comment Share on other sites More sharing options...
Vebers Posted June 12, 2006 Report Share Posted June 12, 2006 Viss ģeniālais ir vienkāršs. Tikai nebūtu vēlams atstāt tās 30 sekundes ;) Link to comment Share on other sites More sharing options...
SkaKri Posted June 12, 2006 Author Report Share Posted June 12, 2006 o jā, darbojas. uz 5-10? Link to comment Share on other sites More sharing options...
Vebers Posted June 12, 2006 Report Share Posted June 12, 2006 Atkarīgs no serveriem. Patestē labāk to laiku... Link to comment Share on other sites More sharing options...
SkaKri Posted June 12, 2006 Author Report Share Posted June 12, 2006 labais, paldies! vēl viens - var ar šo funkciju nolasīt attiecīgo lapu, un pēc tam ar kādu f-ciju izvadīt daļu no lapas? piemēram - tekstu, kas atrodas starp <h1> utt Link to comment Share on other sites More sharing options...
Vebers Posted June 12, 2006 Report Share Posted June 12, 2006 Jā var. Ielasi attiecīgo lapu un tad ar preg_match , explode vai tamlīdzīgām funkcijām izvelc to kas tev nepieciešams. Piemērus skati augstāk dotajā adresē. Link to comment Share on other sites More sharing options...
SkaKri Posted June 12, 2006 Author Report Share Posted June 12, 2006 paldies. ;D Link to comment Share on other sites More sharing options...
SkaKri Posted June 12, 2006 Author Report Share Posted June 12, 2006 tikai viņš met man laukā miskasti ar: http://www.skvots.net/test.php $fp = fsockopen("62.84.1.86", 8000, $errno, $errstr, 4); if (!$fp) { echo "radio offline<br />\n"; } else { $out = "GET / HTTP/1.1\r\n"; $out .= "Host: 62.84.1.86:8000\r\n"; $out .= "Connection: Close\r\n\r\n"; echo "<a href=\"http://beta.radio.skvots.net:8000/\">radio online</a><br />\n"; fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp); } Link to comment Share on other sites More sharing options...
Vebers Posted June 12, 2006 Report Share Posted June 12, 2006 Neredzu kas tur notiekas (The connection has timed out). Link to comment Share on other sites More sharing options...
SkaKri Posted June 12, 2006 Author Report Share Posted June 12, 2006 uzliku lielāku timeout varbūt headerī jānorāda content-type? tik kāds bija html.. apskatīš' Link to comment Share on other sites More sharing options...
Vebers Posted June 12, 2006 Report Share Posted June 12, 2006 O jā, tur trūkst headeris. Liekas ka derētu: header("Content-type: audio/mpeg"); bet tad jānovāc tas Radio online! Nekas pirms header nedrīkt būs izsūtīts un iekš audio/mpeg nedrīkst būs k-kāds html. Link to comment Share on other sites More sharing options...
SkaKri Posted June 12, 2006 Author Report Share Posted June 12, 2006 ok, noņēmu, bet audio/mpeg nederēs, jo tas nav mūz fails, kurš tiek lasīts, bet gan html... Link to comment Share on other sites More sharing options...
Recommended Posts