Bài đăng

Đang hiển thị bài đăng từ tháng 8 31, 2008

Check If a URL is Valid or Not

function is_valid_url ( $url ) $url = @parse_url($url); if ( ! $url) { return false; } $url = array_map('trim', $url); $url['port'] = (!isset($url['port'])) ? 80 : (int)$url['port']; $path = (isset($url['path'])) ? $url['path'] : ''; if ($path == ''){ $path = '/'; } $path .= ( isset ( $url['query'] ) ) ? "?$url[query]" : ''; if ( isset ( $url['host'] ) AND $url['host'] != gethostbyname ( $url['host'] ) ){ if ( PHP_VERSION >= 5 ){ $headers = get_headers("$url[scheme]://$url[host]:$url[port]$path"); }else{ $fp = fsockopen($url['host'], $url['port'], $errno, $errstr, 30); if ( ! $fp ){ return false; } fputs($fp, "HEAD $path HTTP/1.1\r\nHost: $url[host]\r\n\r\n"); $headers = fread ( $fp, 128 ); fclose ( $fp ); } $headers = ( is_array ( $headers ) ) ? implode ( &

loading other message for other div in xajax

require_once("xajax_core/xajax.inc.php"); $xajax = new xajax(); // SEE file list below! $xajax-&gtsetFlag("debug", false); function callScript($oRequest) { $response = new xajaxResponse(); $value = "this is a string duoc tra ve"; for($i=0;$i&lt1000;$i++){ for($j=0;$j&lt10000;$j++){} } $response-&gtassign($oRequest, "innerHTML", nl2br(print_r($value."0 - ".$i." - ".$j." - ".$oRequest, true))); return $response; } $xajax-&gtregisterFunction("callScript"); $xajax-&gtprocessRequest(); ?> "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> &lthtml xmlns="http://www.w3.org/1999/xhtml"> &lthead> &lttitle&gtxajax Tests $xajax_files = array(); $xajax_files[] = array("xajax_js/xajax_core.js", "xajax"); // $xajax_files[] = array("xajax_js/xajax_debug.js", &qu