Sunday, July 17, 2011

PHP Function to Check URL

The following PHP function is used to check if the URL exists. This php function will monitor the http requests and returns the header information. This function is very useful when you are validating the given URL

function checkUrl($url) {
$root = _getRoot($url);
$ctx = stream_context_create(array(
'http' => array(
'max_redirects' => 5, // allows 4 redirects :/
'timeout' => 5,
)
));
$fp = @fopen($url, 'r', false, $ctx);
$ret['success'] = false;
if (! $fp) {
return $ret;
}
$ret['locations'] = array();
$ret['metaData'] = stream_get_meta_data($fp);
fclose($fp);
// analyze HTTP headers
foreach ($ret['metaData']['wrapper_data'] as $line) {
if (preg_match('@^Location: (.*)$@i', $line, $m)) {
if ($m[1][0] === '/') {
// root-relative URI
$m[1] = $root . $m[1];
} elseif (strpos($m[1], '://') >= 4) {
// full URL
$root = _getRoot($m[1]);
}
$ret['locations'][] = $m[1];
}
if (preg_match('@^HTTP/1\.[01] 200@i', $line, $m)) {
$ret['success'] = true;
}
}
return $ret;
}

function _getRoot($url) {
list($proto, $url) = explode('://', $url, 2);
list($host) = explode('/', $url, 2);
return $proto . '://' . $host;
}



var_export(checkUrl('http://microsoft.com/ie'));

// outputs

array (
'success' => true,
'locations' =>
array (
0 => 'http://www.microsoft.com/ie',
1 => 'http://www.microsoft.com/ie/',
2 => 'http://www.microsoft.com/windows/internet-explorer/default.aspx',
),
'metaData' =>
array (
'wrapper_data' =>
array (
... abunch of HTTP headers
),
'wrapper_type' => 'http',
'stream_type' => 'tcp_socket/ssl',
'mode' => 'r+',
'unread_bytes' => 3478,
'seekable' => false,
'uri' => 'http://microsoft.com/ie',
'timed_out' => false,
'blocked' => true,
'eof' => false,
),
)



Check these out

http://hungred.com/how-to/php-check-remote-email-url-image-link-exist/

http://w-shadow.com/blog/2007/08/02/how-to-check-if-page-exists-with-curl/

Saturday, July 16, 2011

Cool WEB

http://pelfusion.com/tools/26-worth-knowing-php-tools-resources-for-web-developers/
http://www.webdesignerdepot.com/2011/07/30-creative-qr-code-business-cards/
Create Rounded Corners with CSS3 Border-Radius Property

247 Hand Drawn Web Icons Free for Download

http://www.webappers.com/2011/03/24/css-modal-box-without-javascript-or-images/

http://www.webappers.com/2011/02/24/tutorial-on-how-to-send-text-messages-with-php/

http://www.webappers.com/2011/02/17/how-to-create-css-drop-shadows-without-images/

http://www.webappers.com/2011/02/15/avactis-2-with-visual-css-editor-visual-layout-editor/

http://www.webappers.com/2011/02/10/html5-game-framework-for-touchscreens-browsers/

http://www.webappers.com/2011/01/24/jquery-file-upload-with-upload-progress-bar/

http://www.webappers.com/2011/01/17/videojs-html5-video-player-with-pure-css-skins/

http://www.webappers.com/2011/01/07/how-to-work-with-new-web-technologies/

http://www.webappers.com/2010/11/24/20-things-i-learned-about-browsers-and-the-web/

http://www.webappers.com/2010/11/18/offline-learning-pack-for-jquery/

http://www.webappers.com/2010/11/09/ajax-file-uploader-with-progress-bar-drag-drop/

http://www.webappers.com/2010/10/21/how-to-create-html5-forms/

http://www.webappers.com/2010/10/06/add-notes-to-any-images-with-jquery-notes/

http://www.webappers.com/2010/10/01/240-flag-icons-in-every-size-you-need/

http://www.webappers.com/2010/09/23/pure-css-progress-bar-with-javascript-for-animation/

http://www.webappers.com/2008/11/11/free-glossy-modern-web-browsers-icons-download/

http://www.webappers.com/2010/09/08/open-source-wysiwyg-html-editor-using-jquery-ui/

http://www.webappers.com/2011/06/10/html5-drag-drop-image-file-uploader-jquery-plugin/

http://www.webdesignshock.com/news/css3-guide-features-properties/

http://www.webdesignshock.com/news/gradients-property-css3/

http://www.webdesignshock.com/news/css-class-id-single-sprite/

MUST


http://webdesigneraid.com/7-html5-videos-to-learn-for-beginners/

http://www.webresourcesdepot.com/15-must-have-bookmarklets-for-web-designers-and-developers/

http://dev.opera.com/articles/view/custom-html5-video-player-with-css3-and-jquery/

http://www.photoshoplady.com/the-100-most-popular-photoshop-tutorials-2008/

http://www.pageresource.com/

http://designtutorials4u.com/15-must-have-resources-for-web-designers/


WhAT are

Friday, July 15, 2011

HTML clocks using JavaScript and CSS rotation

The two clocks below are just HTML. There are no Adobe Flash files or my beloved <canvas> going on, just regular <div> and <img> tags. The way it works is by taking those images in an { overflow: hidden } <div> and rotating them, via JavaScript, using the proposed CSS transform property.

HTML clocks using JavaScript and CSS rotation