Home » Articles, Google App Engine, JavaScript, PHP, PHP Code, Style & Scripts »

3

Hi friends, in this post i am going to explain about how to convert feeds to html using javascript and php. Just provide feed url and get the list of entries and description from the feeds. In my previous post explained about steps to implement and hosting your website in google app engine for free.I have placed the Javascript code in google app engine hosted site.

how to convert feeds to html using javascript and php | Anil Labs

how to convert feeds to html using javascript and php | Anil Labs

  

 
Here i will explain how to get the entries with dynamic styles. In have created this post with using my previous posts.

1) How to get links from feed using php

http://www.anil2u.info/2009/12/how-to-get-links-from-feed-using-php/
 

2) How to clean a string using php code

http://www.anil2u.info/2010/02/how-to-clean-a-string-using-php-code/
 

3) How to create rss feeds using php and mysql

http://www.anil2u.info/2010/07/how-to-create-rss-feeds-using-php-and-mysql/
 

4)Examples for PHP Headers (301,302,404,…)

http://www.anil2u.info/2011/04/examples-for-php-headers-301302404/
 

5)how to include external js,css files with javascript

http://www.anil2u.info/2010/09/how-to-include-external-jscss-files-with-javascript/
 
In some servers DOMDocument(); is not working. For this we have to change the code like below
 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  <?php
       // initialize a new curl resource
       $ch = curl_init();
       // set the url to fetch
       curl_setopt($ch, CURLOPT_URL, $xml);
       // don't give me the headers just the content
       curl_setopt($ch, CURLOPT_HEADER, 0);
       // return the value instead of printing the response to browser
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
       // use a user agent to mimic a browser
       curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0');
       $details = curl_exec($ch);
       // remember to always close the session and free all resources
       curl_close($ch);
  ?>

I have explained in the demo. Provide the feed url and font-size and get the javascript code. Place it in your html page.

 


Related Posts

    How to get list of table names from database in mysql?Auto post into Blogspot using php code?How to connect to FTP and upload file using php code?PHP graphs using google visualizations chart api

 

3 Comments

  1. ReSAprakasa says:

    welldone

  2. Marcos says:

    You can do the opposite?
    Transform HTML in JavaScript?

Leave a Reply