Free Business Consulting

How to get other/external website’s content and store it into your database?


May162012
blog-image
admincURLJSONPHPWeb Services0 Comments

Manier times we come across requirement like fetching/getting content from other website and store that content in our database. So don’t worry now. The code is ready for you. 🙂

Fetch external website’s content and store it into your database:

First of all, make sure that the external site is providing API to fetch/get content from their site. Once you have got the API, Just go through different parameters they are providing for fetching/getting content from the external site. In this way, you will need to make a URL in which you can pass the parameters as per your requirement. We assume that you are ready with the URL(API) of the external website from which you want to fetch/get content and store it into your database.

API is providing content in two formats:
1) JSON
2) XML.
Here we are progressing with output in JSON.

Now $results is our resultant array. You can check the results by echoing the $results.You need to run the loop for getting array content and fire the INSERT query for inserting content into your database. You can also display the results on your web page.

mysql_query(“INSERT into TABLE_NAME (FIELD_NAME) VALUES (‘VALUE’)”);

Here is the example for Fetching/Getting reviews from citysearch.com.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Get News In Your Inbox

Popular Blogs

recent-blog-image
How to create callback functions for jQuery plugins & extensions?

Most of the time custom jQuery plugins and extensions that we create do not use callback functions. They usually simply work on DOM elements or do some calculations. But there…

Continue Reading
recent-blog-image
Top 5 Best Ecommerce plugins in WordPress

Nowadays online shopping has increased and become very convenient shopping place for users, you may be wanting to start your own online shop so you can unleash your products to…

Continue Reading
recent-blog-image
10 Best WordPress Live Chat Plugins for Customer Support

The Live chat is the common thing now days, if you own any eCommerce website or if you are the service provider. It makes easy for your customers to contact…

Continue Reading
recent-blog-image
Free plagiarism checker sites

Plagiarism is the process of taking someone’s ideas & work and passing them off as one’s own. Prevent Plagiarism to check originality of content is the most important factor for…

Continue Reading
recent-blog-image
How to show wordpress posts in other CMS?

Currently since from few weeks, I am working on Expression Engine. Now you thought that what is Expression Engine. Now let me explain you in little brief. Expression Engine is…

Continue Reading

Remarkable Facts About Us

0 %
Client satisfaction
0 +
Years of Experience
0 +
Happy Clients
+
Projects Accomplished

Ready to Get Started ?