Devils666 Posted April 14, 2010 Report Share Posted April 14, 2010 mana problēma tāda, ka javascript īpaši nesaprotu, bet man vaig izveidot tādu kodu: ja iframe links tiek atrasts un lapa ir online, tad parādīt iframe, ja nē, tad parādīt tikai to ka iframe netika atrasta ka kaut ko tadu varētu dabūt gatavu? Quote Link to comment Share on other sites More sharing options...
Devils666 Posted April 14, 2010 Author Report Share Posted April 14, 2010 (edited) sākuma, vismaz vai kāds var pateikt, vai ar javascriptu var pārbaudīt, piemēram - www.uberkrutais.lv, vai lapa ir online vai nav Edited April 14, 2010 by Devils666 Quote Link to comment Share on other sites More sharing options...
marcis Posted April 14, 2010 Report Share Posted April 14, 2010 Ko tavā izpratnē nozīmē "vai lapa ir online" ? Quote Link to comment Share on other sites More sharing options...
Devils666 Posted April 14, 2010 Author Report Share Posted April 14, 2010 (edited) nu vienkārši, vai viņa atbil vai nē ar php tas būtu piem šādi: <? function Visit($url) { $agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";$ch=curl_init(); curl_setopt ($ch, CURLOPT_URL,$url ); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch,CURLOPT_VERBOSE,false); curl_setopt($ch, CURLOPT_TIMEOUT, 5); $page=curl_exec($ch); //echo curl_error($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if($httpcode>=200 && $httpcode<300) return true; else return false; } if(Visit("http://www.domain.com")) echo "Website OK"."n"; /*if site down*/ else echo "Website DOWN"; ?> Edited April 14, 2010 by Devils666 Quote Link to comment Share on other sites More sharing options...
briedis Posted April 14, 2010 Report Share Posted April 14, 2010 Nu, ņem to pašu curl skriptu un liec lietā ajaxi... Quote Link to comment Share on other sites More sharing options...
Devils666 Posted April 14, 2010 Author Report Share Posted April 14, 2010 esmu atradis labu bezmaksas hostu, bēt viņam ir pāris limiti, kā piemeram izejosišie visi slēgti, tapēc ar php es nevaru nekādus izejosos datus iegūt... un tapēc gribu to mēgināt izdarīt ar JS Quote Link to comment Share on other sites More sharing options...
briedis Posted April 14, 2010 Report Share Posted April 14, 2010 (edited) Šis nav testēts, bet moš strādā :) diezgan haxorīgs variants: <img src="http://hosts.com/bildiite.jpg" onerror="hostsOffline()" onload="hostsOnline()" style="display:none;"/> ...protams, ja tas ir webserveris, un tur eksistē kāda bilde... Edited April 14, 2010 by briedis Quote Link to comment Share on other sites More sharing options...
Devils666 Posted April 14, 2010 Author Report Share Posted April 14, 2010 hmm, bet kā tas domāts? es to ko tu man iedevu isti nesaprotu :( un man jau to uz iframe vajadzēja... Quote Link to comment Share on other sites More sharing options...
briedis Posted April 14, 2010 Report Share Posted April 14, 2010 hmm, bet kā tas domāts? es to ko tu man iedevu isti nesaprotu :( un man jau to uz iframe vajadzēja... Nu izveido attiecīgās funkcijas, kas dinamiski parāda/paslēpj ifreimu, uzstādam tam vajadzīgo atribūta src vērtību... Quote Link to comment Share on other sites More sharing options...
Devils666 Posted April 14, 2010 Author Report Share Posted April 14, 2010 <img src="http://miljons.com/img/logolv.gif" onerror="hostsOffline()" onload="hostsOnline()" style="display:none;"/> <iframe src='http://miljons.com' width=300 height=300 border=0 frameborder=0 scrolling=no></iframe> bet priekškam tā bilde isti domata? kaut ko nesaprotu... Quote Link to comment Share on other sites More sharing options...
briedis Posted April 14, 2010 Report Share Posted April 14, 2010 <img src="http://miljons.com/img/logolv.gif" onerror="hostsOffline()" onload="hostsOnline()" style="display:none;"/> <iframe src='http://miljons.com' width=300 height=300 border=0 frameborder=0 scrolling=no></iframe> bet priekškam tā bilde isti domata? kaut ko nesaprotu... "sākuma, vismaz vai kāds var pateikt, vai ar javascriptu var pārbaudīt, piemēram - www.uberkrutais.lv, vai lapa ir online vai nav " Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.