RSS feed is used to provide updates of blog or website for various platforms. We can use these feed to display as latest updates, news etc on our site. In this post I am explaining how to read rss feeds using php. Let’s our rss feed url is http://demos.tricksofit.com/files/rss.php Now we will read the content of the url using file_get_contents and store it in a variable called $content. file_get_contents — …
How to Create RSS Feed in PHP
RSS stands for Really Simple Syndication. It’s an XML-based content format for distributing content, news etc. It makes your content global and available to various platforms. Most popular sites and blogs provide RSS feeds for you to subscribe. You need a feed reader to view its contents, that’s all. You can also create RSS feeds for your own website. In this post I am explaining how to create RSS feed …
Difference Between PDO And MySQLi
We have two choices for accessing the database in PHP : MySQLi and PDO. We have already compared them with old mysql extension in Difference between mysql and pdo and Difference between MySQL and MySQLi. In this article, we will discuss difference between PDO and MySQLi on various feature like database support, stability and performance to find which is the better API. Connection : // PDO // mysqli, procedural style …
Get geolocation from ip in PHP
In PHP, there is no direct way to get geolocation of an IP address. Therefore we have to use third party API to get geolocation from ip address. There are many paid and free APIs available to get geolocation from ip address. I found a very simple and easy api freegeoip.net. It is a public RESTful web service API for searching geolocation of IP addresses and host names. freegeoip.net API …
Getting Visitor IP Address in PHP
Some times we need to get visitor’s ip address for validation, security, spam prevention etc. In php it’s easy to get visitor ip address. No Proxy detection If there is no proxy detection we can get the visitor ip address with a simplest way as follow: But If a user access the website via a proxy server $_SERVER[‘REMOTE_ADDR’] will return the ip address of proxy server not of the proxy …
How to Add Apple Touch Icon to Website
Mobile browsing is rapidly growing. We all know the importance of providing a better experience for our mobile customers. To get mobile traffic you can take a simple step to learn how to add Apple Touch Icon to website. If you are not using Apple Icons, iOS grabs a compressed thumbnail of your website and use it as an icon. Adding apple touch icons to website is like adding favicons …
Difference between MySQL and MySQLi
As we know the mysql_* functions are deprecated in PHP 5.5. So you should not use mysql_* functions in your application. We have better alternative of MySql is MySQL Improved that is MySQLi. In this article I am listing the difference between MySql and MySqli. MySQLi: – The i stands for Improved. The MySQLi extension is designed to work with MySQL version 4.1.13 or newer. MySQLi introduced with PHP 5.0 …
XML Parsing with SimpleXML
XML Parsing basically means navigate XML document and provide the relevant data. Web services normally return data in XML format, you need to parse XML if you want to full use of APIs. In php 5.0 we have SimpleXML extension that provides a simple way to get XML element’s name and text. SimpleXML is fast and easy to use to read/extract data from XML strings. In this article I will …