Archive for February, 2010

1. Download this file and import it into your database. Postcodes.txt 2. Rename Postcode.txt to Postcode.sql 3. Import to your database and enjoy complete list of UK Postcodes. Here is the sample code: CREATE TABLE IF NOT EXISTS `postcodes` ( `id` int(11) NOT NULL auto_increment, `postcode` tinytext NOT NULL, `grid_n` varchar(15) NOT NULL, `grid_e` varchar(15) NOT NULL, `latitude` varchar(15) NOT NULL, `longitude` varchar(15) …

<?php $string = ‘<a href="http://www.test.com">test.com</a> has many links with tests <a href="http://www.test.net/file.php">links</a> to many sites and even urls without links like http://www.test.org just to fill the gaps and not to forget this one http://www.imjan.com/php-interview-questions/curl-register-your-domain-but-check-its-availability/ which has a space after it. The script has been modifiied from its original so now it grabs ssl such as https://www.test.com/abc.php also’; function getAllUrls($string){ $regex = ‘/https?\:\/\/[^\" ]+/i’; …

What Does PHP Stand For?

 on February 18, 2010

PHP is short form of “Hypertext Preprocessor”.

Google says :- “Google Adsense is the program that can generate promotion revenue from each page on your website—with a minimal investment in time and no additional resources. Google is not only a great search engine but with the release of “adsense” it can also pay for your hosting/domain and if you work hard even your holidays Adsense delivers relevant ads that are …

Its very easy to change the contents of div in javascript. Just get the object of div using getElemementbyID() or getElementbyName() and use innerHTML property with the new value. divObj = document. getElementbyID("mydiv"); divObj.innerHTML = ‘<p>This is a html code</p>’;

PHP supports libcurl is a library that allows you to connect and communicate to many different types of servers with many different types of protocols. LIBCURL (CURL LIBRARY PHP) currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. LIBCURL (CURL LIBRARY PHP) also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP’s …

The following is a simple example of how to submit data from one HTML page to another using the POST method from Javascript. Normally, if data needs to be sent from one HTML page to another, it is done by appending the information to the query parameter of the the URL in the familiar “name=value” format. e.g. <a href="post.aspx?user=peter&cc=aus">Click</a> Although this works fine, …

echo $_SERVER['REMOTE_ADDR'];

<?php $username = "your_name"; $password = "your password"; $hostname = "localhost"; $dbname = "database name"; //Connection to the MySql Database $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); mysql_select_db("$dbname",$db); echo "Connected to MySQL"; ?>

function getOnlyDomain($url) { $myurl = ereg_replace(‘www\.’,”,$url); $domain = parse_url($myurl); if(!empty($domain["host"])){ return $domain["host"]; } else { return $domain["path"]; } }//end funciton echo getOnlyDomain(‘http://www.imjan.com/php-interview-questions/using-php-curl-to-read-and-write-rss-feed-xml/’);