check url with php
function http_test_existance($url) { return (($fp = @fopen($url, 'r')) === false) ? false : @fclose($fp); }
12389 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Oliver Haag www.ohcon.de
function http_test_existance($url) { return (($fp = @fopen($url, 'r')) === false) ? false : @fclose($fp); }
<!-- Formular auswerten (evaluate form) ********************************** --> <?php $hidden_value_1 = $_POST['hval1']; $hidden_value_2 = $_POST['hval2']; $short_text = $_POST['stext']; $password = $_POST['pwd']; $long_text = $_POST['ltext']; $selected_option = $_POST['optn']; $radio_selection = $_POST['radsel']; $check_selection = $_POST['checksel']; $check_text = implode(', ',$check_selection); ?> <html><body> <h1>Kurze Anzeige (show values)</h1> Versteckte Werte: <?=$hidden_value_1?>, <?=$hidden_value_2?><br> Kurzer Text und Passwort: <?=$short_text?>, <span style="color: gray;"><?=$password?></span><br> Langer Text: <?=$long_text?><br> Option: <?=$selected_option?><br> Radio-Auswahl: <?=$radio_selection?><br> CheckBox-Auswahl: <?=$check_text?> <h1>Ein Formular (form)</h1> <!-- Das Beispielformular (form example) ********************************** --> <form action="form.php" method="post"> <!-- versteckte Elemente (hidden elements) --> <input type="hidden" name="hval1" value="Der erste versteckte Wert"> <input type="hidden" name="hval2" value="Der zweite versteckte Wert"> <p> <!-- einzeiliges Eingabefeld und Passwortfeld (text fields) --> Kurzer Text und Passwort <br> <input type="text" size="32" maxlength="64" name="stext" value="Kurze Textvorbelegung"> <input type="password" size="16" maxlength="16" name="pwd" value="geheim"> </p><p> <!-- mehrzeiliges Eingabefeld (text area) --> Langer Text <br> <textarea cols="128" rows="4" name="ltext"> Optionale Textvorbelegung (optional text presetting): kann bei mehrzeiligen Textfeldern lang sein,da genügend Platz vorhanden ist. </textarea> </p><p> <!-- Auswahlliste mit Vorauswahl (selection list) --> Option <br> <select name="optn"> <option selected>Die Erste Option</option> <option>Die zweite Option</option> <option>Die dritte Option</option> </select> </p><p> <!-- Radio-Buttons mit Vorauswahl (radio buttons) --> Radio-Auswahl <br> <input type="radio" name="radsel" value="first">Die erste Radiowahl<br> <input type="radio" name="radsel" value="seccond">Die zweite Radiowahl<br> <input type="radio" name="radsel" value="third" checked> Die dritte Radiowahl </p><p> CheckBox-Auswahl <br> <input type="checkbox" name="checksel[]" value="chk1" checked>Die erste Checkwahl<br> <input type="checkbox" name="checksel[]" value="chk2" checked>Die zweite Checkwahl<br> <input type="checkbox" name="checksel[]" value="chk3">Die dritte Checkwahl </p><p> <!-- Buttons zum Absenden/ Abbrechen (buttons to submit/reset) --> <input type="submit" value="auswerten"> <input type="reset" value="zurücksetzen"> </form> </body></html>
<h1>Howto Confirm Delete</h1> <form action="delete.html" method="post"> <input type="button" onclick="if (confirm('sure?')) submit();" value="delete"> </form>
<script type="text/javascript"> function changeText(txt){ document.getElementById('the_text').innerHTML = txt; } </script> <p>Hello <b id='name'>World</b>. </p> <input type='button' onclick='changeText("Oliver")' value='Change Text'/>
#1 get coordinates #2 add meta tags to head <meta name="ICBM" content="XXX.XXXXX, YYY.YYYYY"> <meta name="DC.title" content="THE NAME OF YOUR SITE"> #3 ping http://geourl.org/ping/
RewriteEngine On RewriteBase /the_directory RewriteRule ^(.*).html$ $1.php [R=301]
RewriteRule cms/fest$ cms/index.php?option=content&task=view&id=176&Itemid=202 [NC]
<div style="text-align:center"> <div style="margin:auto">the text</div> </div>
<table><tr><td valign="middle">the text</td></tr></table>
<div style="display:table-cell; vertical-align: middle">the text</div>
# google.com search_term site:http://snippets.dzone.com
require 'rwebunit' # ruby web test based on watir (uses ie=internet-explorer-object) # test if sites are online by title validation # usage: to run this test without visible ie use the -b option # C:\ruby\workspace\ruject1>ruby rwu_site_checker.rb -b class RwuSiteChecker < RWebUnit::WebTestCase # hash with url and title @@sites = { "http://www.domain_number_one.de" => "title number one", "http://www.seccond_domain.org" => "seccond title", "http://www.yet_another_domain.com" => "yet another title" } # test for titles def test_titles() log = "testing title \n" @@sites.each { |url, title| getTestContext().base_url=url beginAt("/") assertTitleEquals(title) # to check for phrase: assertTextPresent(phrase) log += url + " ok \n" } puts log end end