Forum arrow_forward_ios Codding

Questions By
Muhamad Ali
card_giftcard ₹0

question_answer How to create rss.xml file using PHP?

I need to get the data from MySQL and create an rss.xml file for my website.

I want to create an rss.xml file dynamically using PHP.

I need the PHP code for building it.

25-09-2019, Total 1 Ans , 77 views


more_horiz Other Answers

To create rss.xml dynamically using the PHP, use this code

$xml=new DOMDocument("1.0","UTF-8"); $xml->formatOutput=true; $urlset=$xml->createElement("rss"); $urlset->setAttribute("version","2.0"); $urlset->setAttribute("xmlns:atom","http://www.w3.org/2005/Atom"); $xml->appendChild($urlset); //Getting from database //-------------------------------------------------- //FOR MRITUNJOY BLOGS START //-------------------------------------------------- $blogsChannel=$xml->createElement("channel"); $urlset->appendChild($blogsChannel); $atom = $xml->createElement('atom:link'); //add atom node $atom->setAttribute('href', 'https://mritunjoy.com/rss.xml'); //add atom node attribute $atom->setAttribute('rel', 'self'); $atom->setAttribute('type', 'application/rss+xml'); $blogsChannel->appendChild($atom); //CHANNEL Title $loc=$xml->createElement("title","Website title here"); $blogsChannel->appendChild($loc); //Create Link $loc=$xml->createElement("link",'https://mritunjoy.com/blogs'); $blogsChannel->appendChild($loc); //Create Description $loc=$xml->createElement("description","Description here"); $blogsChannel->appendChild($loc); //Create Images $image=$xml->createElement("image"); $blogsChannel->appendChild($image); //IMAGE URL $loc=$xml->createElement("url","https://mritunjoy.com/styles/icons/1.png"); $image->appendChild($loc); //IMAGE TITLE $loc=$xml->createElement("title","Website title"); $image->appendChild($loc); //IMAGE LINK $loc=$xml->createElement("link","https://mritunjoy.com"); $image->appendChild($loc); $result=mysqli_query($database,"SELECT * FROM data"); while($row=mysqli_fetch_assoc($result)){ $bgid=$row['id']; $blogtitle=$row['title']; $blogdescription=$row['description']; $blogcategory=$row['category']; $blogdescription=str_replace("[&]", "", $blogdescription); $blogdescription=str_replace("<", "", $blogdescription); $blogdescription=str_replace(">", "", $blogdescription); //CREATE ITEMS $item=$xml->createElement("item"); $blogsChannel->appendChild($item); //Create Title $blogtitle=str_replace("|", "", $blogtitle); $blogtitle=str_replace("/", "", $blogtitle); $blogtitle=str_replace("\'", "", $blogtitle); $blogtitle=str_replace(";", "", $blogtitle); $blogtitle=str_replace("&", "", $blogtitle); $blogtitle=str_replace("<", "", $blogtitle); $blogtitle=str_replace(">", "", $blogtitle); $loc=$xml->createElement("title",$blogtitle); $item->appendChild($loc); //Create Link $blogtitleurl=str_replace(" ", "-", $blogtitle); $ques_url='https://mritunjoy.com/blog/'.$bgid.'/'.$blogtitleurl; $loc=$xml->createElement("link",$ques_url); $item->appendChild($loc); //Create Description $loc=$xml->createElement("description",$blogdescription); $item->appendChild($loc); //Create Category $loc=$xml->createElement("category",$blogcategory); $item->appendChild($loc); //Create GUID $loc=$xml->createElement("guid",$ques_url); $item->appendChild($loc); } echo "<xmp>".$xml->saveXML().""; $xml->save("rss.xml");


Hop this helps you.


Mritunjoy Mushahary
25-09-2019

Please lock LOGIN to Answer

announcement Recently Asked

question_answer
question_answer
question_answer


announcement Related Ques

question_answer
question_answer
question_answer
question_answer
question_answer
How to get date of every after 30 days using PHP?
Ans(1) ₹0 check_circle_outline
question_answer
How to get the nested Array Data using PHP?
Ans(1) ₹0 check_circle_outline
question_answer
How to properly get Pre Signed URL from s3 Bucket?
Ans(1) ₹0 check_circle_outline
question_answer
How much is the Margin Money of PMEGP Loan fo ST?
Ans(1) ₹0 check_circle_outline
question_answer
I want to register SENDER ID for my SNS SMS, on AWS.
Ans(1) ₹0 check_circle_outline
question_answer
Which is the right time to get EDP Training?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
How much Amazon Cloud Hosting charges?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
php count variable values separated with comma
Ans(2) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
error timezone php or set time php timezone
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
question_answer
What were the documents required for PMEGP Loan?
Ans(1) ₹0 check_circle_outline
question_answer
How to get the present full url using PHP
Ans(2) ₹0 check_circle_outline
question_answer
question_answer
How to transfer data from one website to another?
Ans(2) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
How to delete the terminated intences in AWS Amazon?
Ans(2) ₹0 check_circle_outline
question_answer
Which is the best website to learn MongoDB online?
Ans(3) ₹0 check_circle_outline
question_answer
How many countries Twilio can send SMS?
Ans(2) ₹0 check_circle_outline
question_answer
question_answer
What is the maximum transaction limits in RazorPay?
Ans(1) ₹0 check_circle_outline
question_answer
PHP SDK - Delete Object not working on s3 - error \
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
Linux repeated Keyword problems.. how to solve it?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
How to create discount percentage using php?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
check if the radio input is checked using javascript
Ans(1) ₹0 check_circle_outline
question_answer
PHP code to get the token of Shiprocket.
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
How to use webview on Android studio react native?
Ans(2) ₹0 check_circle_outline
question_answer
question_answer
What is SKU in shiprocket? From where I can get it?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
How to Propose Girls in this 2019?
Ans(2) ₹0 check_circle_outline
question_answer
How to Create Login and Logout system using PHP?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
How to integrate RazorPay with my website using PHP?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
1mb is equal to how much bytes?
Ans(1) ₹0 check_circle_outline
question_answer
How to delete projects from pinPoint on AWS?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
How to enable email functions on php?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
How to do Long poll using PHP and JavaScript?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
How to open a file using Ubuntu Terminal?
Ans(2) ₹0 check_circle_outline
question_answer
question_answer
How to send sms using Terminal on AWS SNS?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
How to install PHP?
Ans(0) ₹0
question_answer
question_answer
question_answer
question_answer
How to write ourl url for SEO on href attribute
Ans(2) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
question_answer
What is the response time of PHP $post variable?
Ans(2) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
question_answer
convert numbers into words in php
Ans(2) ₹0 check_circle_outline
question_answer
html css center horizontal list, menu system
Ans(2) ₹0 check_circle_outline
question_answer
question_answer
question_answer
Which is the most played sports in the world?
Ans(2) ₹0 check_circle_outline
question_answer
question_answer
Need PHP functions to convert currencies.
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
What is the amount of withdrawn in RazorPay?
Ans(1) ₹0 check_circle_outline
question_answer
Need codes to see the Country using Cloudflare.
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
question_answer
Delete s3 object using PHP SDK.
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
Is RazorPay Really simple and esay to ues?
Ans(1) ₹0 check_circle_outline
question_answer
Multiple database vs single database on mysql?
Ans(1) ₹0 check_circle_outline
question_answer
Need codes to send SMS using AWS SNS in PHP.
Ans(1) ₹0 check_circle_outline
question_answer
.htaccess not working on my site .. what to do?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
Is this PMEGP Loan works Offline also?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
EDP Training Center in Kokrajhar area.
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
Which type of area is kown as Urban an Rural?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
The test asking
Ans(0) ₹0
question_answer
question_answer
Need ShipRocket support mobile number.
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
Do Aliens really exists?
Ans(3) ₹0 check_circle_outline
question_answer
How pyshic powers work? Is it real or just rumors?
Ans(3) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
Does girls like a man with a beard and mustache
Ans(2) ₹0 check_circle_outline
question_answer
PMEGP Loan Guide Lines.
Ans(1) ₹0 check_circle_outline
question_answer
What is La Liga?
Ans(1) ₹0 check_circle_outline
question_answer
Need official website links for PMEGP Loan.
Ans(1) ₹0 check_circle_outline
question_answer
multiple aws s3 bucket vs one aws s3 bucket?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
Can I create live straming videos using cloudfront?
Ans(1) ₹0 check_circle_outline
question_answer
question_answer
question_answer
question_answer
What is zend2?
Ans(0) ₹0
question_answer
How much tables one Mysql database can have?
Ans(1) ₹0 check_circle_outline
question_answer

WelCome to the World of Digital Expression

Transform your Works into Digital and Makes your life more easier.

123

Total users

123

Active users

5

Active Earners

location_on BTR,Assam,INDIA
(Bodoland)
email [email protected]
call +91 8486866741
rss_feed

Copyright ©2019-20 mritunjoy.com,All Rights Reserved