Get Title of a Webpage using PHP – 1
<?php function getTitle($Url){ $str = file_get_contents($Url); if(strlen($str)>0){ preg_match(“/<title>(.*)</title>/”,$str,$title); return $title[1]; } } $url=”http://example.com”; echo getTitle($url); ?>
<?php function getTitle($Url){ $str = file_get_contents($Url); if(strlen($str)>0){ preg_match(“/<title>(.*)</title>/”,$str,$title); return $title[1]; } } $url=”http://example.com”; echo getTitle($url); ?>
<?php function curPageURL() { $pageURL = ‘http’; if ($_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;} $pageURL .= “://”; if ($_SERVER[“SERVER_PORT”] != “80”) { $pageURL .= $_SERVER[“SERVER_NAME”].”:”.$_SERVER[“SERVER_PORT”].$_SERVER[“REQUEST_URI”]; } else { $pageURL .= $_SERVER[“SERVER_NAME”].$_SERVER[“REQUEST_URI”]; } return $pageURL; } ?> <?php echo curPageURL(); ?>
<?php function urlQUERY($url) { $url_data = parse_url ($url); if (!$url_data) return FALSE; $path =”; $query =”; if (isset( $url_data[‘path’])) $path .= $url_data[‘path’]; if (isset( $url_data[‘query’])) $query .= ‘?’ .$url_data[‘query’]; echo “$path $query “; } $url=”Enter Your URL”; urlQUERY($url)); ?>
By using the following script you can retrieve a page name. <?php function curPageName() { return substr($_SERVER[“SCRIPT_NAME”],strrpos($_SERVER[“SCRIPT_NAME”],”/”)+1); } echo “The current page name is “.curPageName(); ?>
Now use the =GETURL(cell) to get the URL Example: =GETURL(A1) will return the URL for the Hyperlink displayed in cell A1 Function GETURL(HyperlinkCell As Range) GETURL = HyperlinkCell.Hyperlinks(1).Address End Function
In a Word Document when we paste some data from some source (e.g. Websites). We find that there are some hyperlinks copied into it. Sometimes we want to change the text of all these hyperlinks to a particular word. When it is needed? It is useful where we actually want to remove all these hyperlinks … Read more
To install this all you need to do is: 1. Hit ALT + F11 (Opens Visual Basic Editor) 2. Click on Insert -> Module (adds a module to your excel file) 3. Paste the code 4. Hit ALT + Q (Closes the Visual Basic Editor)
Basically FOUR SQL commands used very often. These four commands are SELECT, INSERT, UPDATE, DELETE By using these four basic commands you can do a lot of queries. SELECT select * from tablename INSERT insert into tablename SET col1=”, col2=” UPDATE update tablename SET col1=”, col2=” WHERE col3=” DELETE delete from tablename WHERE col1=”
Basic Codes is about small codes and Tips. You will find these codes easy to implement and very useful. Codes here are related to web designing codes, macros etc.
GTalk and GMail chat has a feature Invisible Mode, where we can’t see a user who is invisible. I would like to suggest a feature for GTalk and GMail Chat. There should be a feature where if one of my friends is Invisible, then I should have an option to remain invisible to him/her also … Read more