Create XML Feed with PHP on Wordpress (Google Product Reviews)
I am trying to submit my customer reviews to Google so I can start showing my product reviews on Google shopping.
I'm required to submit a feed that looks like this,
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.google.com/shopping/reviews/schema/product/2.2/product_reviews.xsd">
<version>2.2</version>
<aggregator>
<name>Sample Reviews Aggregator (if applicable)</name>
</aggregator>
<publisher>
<name>Sample Retailer</name>
<favicon>http://www.example.com/favicon.png</favicon>
</publisher>
<reviews>
<review>
<!-- full sample - includes all optional elements/attributes -->
<review_id>14295</review_id>
<reviewer>
<name is_anonymous="true">Anonymous</name>
<reviewer_id>509769</reviewer_id>
</reviewer>
<review_timestamp>2014-04-21T07:07:07Z</review_timestamp>
<title>Excellent</title>
<content>Got it for a friend and he loved it.</content>
<pros>
<pro>Sleek design</pro>
<pro>Protects the tablet well</pro>
</pros>
<cons>
<con>Pricey</con>
</cons>
<review_url type="singleton">http://www.example.com/review_14295.html</review_url>
<reviewer_images>
<reviewer_image>
<url>https://example.com/test.jpg</url>
</reviewer_image>
<reviewer_image>
<url>https://example.com/test.gif</url>
</reviewer_image>
</reviewer_images>
<ratings>
<overall min="1" max="5">4.4</overall>
</ratings>
<products>
<product>
<product_ids>
<gtins>
<gtin>541710238425</gtin>
</gtins>
<mpns>
<mpn>60101-10000</mpn>
</mpns>
<skus>
<sku>6206</sku>
</skus>
<brands>
<brand>Acme</brand>
</brands>
</product_ids>
<product_name>Tablet Sleeve</product_name>
<product_url>http://www.example.com/product_6206.html</product_url>
</product>
</products>
<is_spam>false</is_spam>
<collection_method>post_fulfillment</collection_method>
<transaction_id>fulfillment_transaction_11198373</transaction_id>
</review>
<review>
<!-- minimal sample - no optional elements/attributes -->
<reviewer>
<name>Jane</name>
</reviewer>
<review_timestamp>2014-04-21T07:14:21Z</review_timestamp>
<content>I was a little skeptical at first, but it grew on me.</content>
<review_url type="singleton">http://www.example.com/review_59684.html</review_url>
<ratings>
<overall min="1" max="5">4.3</overall>
</ratings>
<products>
<product>
<product_url>http://www.example.com/product_6207.html</product_url>
</product>
</products>
</review>
</reviews>
<deleted_reviews>
<review_id>10438</review_id>
</deleted_reviews>
</feed>
So I created a php file that grabs all that data and wraps it in xml, but I'm not sure how to create an xml file using PHP... I reckon I'd want the php to recreate this page as more reviews come in.
I have the following code in a php file.
<?php
//Get all comments
$comments = get_comments(
array(
'status' => 'approve',
'post_status' => 'publish',
'post_type' => 'product',
'parent' => 0,
'order' => 'DESC',
)
);
foreach ( (array) $comments as $comment ) :
if ( !empty($comment->comment_author) ) {
if (!empty($comment->user_id)){
$user = get_userdata($comment->user_id);
$author = ucfirst(strtolower($user->first_name)).' '.ucfirst(strtolower(substr($user->last_name,0,1))); // this is the actual line you want to change
} else {
$author_name = $comment->comment_author;
$parts = explode(" ", $author_name);
$author = ucfirst(strtolower($parts[0]).' '.(isset($parts[1]) ? ucfirst($parts[1][0]) : ''));
}
} else {
$author = __('Customer');
}
////////////////COMMENT VARIABLES
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
$rating_html = wc_get_rating_html( $rating );
$_date = get_comment_date('', $comment);
$_product = wc_get_product($comment->comment_post_ID);
$content = <<<EOT
<review>
<review_id><?php $comment->comment_ID; ?></review_id>
<reviewer>
<name><?php echo $author; ?></name>
</reviewer>
<review_timestamp><?php echo $_date; ?></review_timestamp>
<content><?php echo $comment->comment_content; ?></content>
<review_url type="group"><?php echo get_permalink($comment->comment_post_ID); ?></review_url>
<ratings>
<overall min="1" max="5"><?php echo $rating; ?></overall>
</ratings>
<products>
<product>
<product_name><?php echo $_product->get_title(); ?></product_name>
<product_url><?php echo $_product->get_permalink(); ?></product_url>
</product>
</products>
<is_spam>false</is_spam>
<collection_method>post_fulfillment</collection_method>
</review>
EOT;
endforeach; ?>
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.google.com/shopping/reviews/schema/product/2.2/product_reviews.xsd">
<version>2.2</version>
<publisher>
<name>Herbal Nitro</name>
<favicon>https://static.herbalnitro.com/wp-content/uploads/2018/07/Favicon-new.png</favicon>
</publisher>
<reviews>
<?php echo $content; ?>
</reviews>
</feed>
Any help would be tremendously helpful!
Sincerely,
Jordan
php xml wordpress feed
add a comment |
I am trying to submit my customer reviews to Google so I can start showing my product reviews on Google shopping.
I'm required to submit a feed that looks like this,
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.google.com/shopping/reviews/schema/product/2.2/product_reviews.xsd">
<version>2.2</version>
<aggregator>
<name>Sample Reviews Aggregator (if applicable)</name>
</aggregator>
<publisher>
<name>Sample Retailer</name>
<favicon>http://www.example.com/favicon.png</favicon>
</publisher>
<reviews>
<review>
<!-- full sample - includes all optional elements/attributes -->
<review_id>14295</review_id>
<reviewer>
<name is_anonymous="true">Anonymous</name>
<reviewer_id>509769</reviewer_id>
</reviewer>
<review_timestamp>2014-04-21T07:07:07Z</review_timestamp>
<title>Excellent</title>
<content>Got it for a friend and he loved it.</content>
<pros>
<pro>Sleek design</pro>
<pro>Protects the tablet well</pro>
</pros>
<cons>
<con>Pricey</con>
</cons>
<review_url type="singleton">http://www.example.com/review_14295.html</review_url>
<reviewer_images>
<reviewer_image>
<url>https://example.com/test.jpg</url>
</reviewer_image>
<reviewer_image>
<url>https://example.com/test.gif</url>
</reviewer_image>
</reviewer_images>
<ratings>
<overall min="1" max="5">4.4</overall>
</ratings>
<products>
<product>
<product_ids>
<gtins>
<gtin>541710238425</gtin>
</gtins>
<mpns>
<mpn>60101-10000</mpn>
</mpns>
<skus>
<sku>6206</sku>
</skus>
<brands>
<brand>Acme</brand>
</brands>
</product_ids>
<product_name>Tablet Sleeve</product_name>
<product_url>http://www.example.com/product_6206.html</product_url>
</product>
</products>
<is_spam>false</is_spam>
<collection_method>post_fulfillment</collection_method>
<transaction_id>fulfillment_transaction_11198373</transaction_id>
</review>
<review>
<!-- minimal sample - no optional elements/attributes -->
<reviewer>
<name>Jane</name>
</reviewer>
<review_timestamp>2014-04-21T07:14:21Z</review_timestamp>
<content>I was a little skeptical at first, but it grew on me.</content>
<review_url type="singleton">http://www.example.com/review_59684.html</review_url>
<ratings>
<overall min="1" max="5">4.3</overall>
</ratings>
<products>
<product>
<product_url>http://www.example.com/product_6207.html</product_url>
</product>
</products>
</review>
</reviews>
<deleted_reviews>
<review_id>10438</review_id>
</deleted_reviews>
</feed>
So I created a php file that grabs all that data and wraps it in xml, but I'm not sure how to create an xml file using PHP... I reckon I'd want the php to recreate this page as more reviews come in.
I have the following code in a php file.
<?php
//Get all comments
$comments = get_comments(
array(
'status' => 'approve',
'post_status' => 'publish',
'post_type' => 'product',
'parent' => 0,
'order' => 'DESC',
)
);
foreach ( (array) $comments as $comment ) :
if ( !empty($comment->comment_author) ) {
if (!empty($comment->user_id)){
$user = get_userdata($comment->user_id);
$author = ucfirst(strtolower($user->first_name)).' '.ucfirst(strtolower(substr($user->last_name,0,1))); // this is the actual line you want to change
} else {
$author_name = $comment->comment_author;
$parts = explode(" ", $author_name);
$author = ucfirst(strtolower($parts[0]).' '.(isset($parts[1]) ? ucfirst($parts[1][0]) : ''));
}
} else {
$author = __('Customer');
}
////////////////COMMENT VARIABLES
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
$rating_html = wc_get_rating_html( $rating );
$_date = get_comment_date('', $comment);
$_product = wc_get_product($comment->comment_post_ID);
$content = <<<EOT
<review>
<review_id><?php $comment->comment_ID; ?></review_id>
<reviewer>
<name><?php echo $author; ?></name>
</reviewer>
<review_timestamp><?php echo $_date; ?></review_timestamp>
<content><?php echo $comment->comment_content; ?></content>
<review_url type="group"><?php echo get_permalink($comment->comment_post_ID); ?></review_url>
<ratings>
<overall min="1" max="5"><?php echo $rating; ?></overall>
</ratings>
<products>
<product>
<product_name><?php echo $_product->get_title(); ?></product_name>
<product_url><?php echo $_product->get_permalink(); ?></product_url>
</product>
</products>
<is_spam>false</is_spam>
<collection_method>post_fulfillment</collection_method>
</review>
EOT;
endforeach; ?>
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.google.com/shopping/reviews/schema/product/2.2/product_reviews.xsd">
<version>2.2</version>
<publisher>
<name>Herbal Nitro</name>
<favicon>https://static.herbalnitro.com/wp-content/uploads/2018/07/Favicon-new.png</favicon>
</publisher>
<reviews>
<?php echo $content; ?>
</reviews>
</feed>
Any help would be tremendously helpful!
Sincerely,
Jordan
php xml wordpress feed
No, just no. You can't jam together a bunch of strings and call it XML. You need to use proper XML APIs to create the file.
– miken32
Nov 23 '18 at 22:18
Possible duplicate of How to generate XML file dynamically using PHP?
– miken32
Nov 23 '18 at 22:18
That said, I wouldn't be surprised if there were an existing library that could specifically create XML for Google's purposes.
– miken32
Nov 23 '18 at 22:21
add a comment |
I am trying to submit my customer reviews to Google so I can start showing my product reviews on Google shopping.
I'm required to submit a feed that looks like this,
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.google.com/shopping/reviews/schema/product/2.2/product_reviews.xsd">
<version>2.2</version>
<aggregator>
<name>Sample Reviews Aggregator (if applicable)</name>
</aggregator>
<publisher>
<name>Sample Retailer</name>
<favicon>http://www.example.com/favicon.png</favicon>
</publisher>
<reviews>
<review>
<!-- full sample - includes all optional elements/attributes -->
<review_id>14295</review_id>
<reviewer>
<name is_anonymous="true">Anonymous</name>
<reviewer_id>509769</reviewer_id>
</reviewer>
<review_timestamp>2014-04-21T07:07:07Z</review_timestamp>
<title>Excellent</title>
<content>Got it for a friend and he loved it.</content>
<pros>
<pro>Sleek design</pro>
<pro>Protects the tablet well</pro>
</pros>
<cons>
<con>Pricey</con>
</cons>
<review_url type="singleton">http://www.example.com/review_14295.html</review_url>
<reviewer_images>
<reviewer_image>
<url>https://example.com/test.jpg</url>
</reviewer_image>
<reviewer_image>
<url>https://example.com/test.gif</url>
</reviewer_image>
</reviewer_images>
<ratings>
<overall min="1" max="5">4.4</overall>
</ratings>
<products>
<product>
<product_ids>
<gtins>
<gtin>541710238425</gtin>
</gtins>
<mpns>
<mpn>60101-10000</mpn>
</mpns>
<skus>
<sku>6206</sku>
</skus>
<brands>
<brand>Acme</brand>
</brands>
</product_ids>
<product_name>Tablet Sleeve</product_name>
<product_url>http://www.example.com/product_6206.html</product_url>
</product>
</products>
<is_spam>false</is_spam>
<collection_method>post_fulfillment</collection_method>
<transaction_id>fulfillment_transaction_11198373</transaction_id>
</review>
<review>
<!-- minimal sample - no optional elements/attributes -->
<reviewer>
<name>Jane</name>
</reviewer>
<review_timestamp>2014-04-21T07:14:21Z</review_timestamp>
<content>I was a little skeptical at first, but it grew on me.</content>
<review_url type="singleton">http://www.example.com/review_59684.html</review_url>
<ratings>
<overall min="1" max="5">4.3</overall>
</ratings>
<products>
<product>
<product_url>http://www.example.com/product_6207.html</product_url>
</product>
</products>
</review>
</reviews>
<deleted_reviews>
<review_id>10438</review_id>
</deleted_reviews>
</feed>
So I created a php file that grabs all that data and wraps it in xml, but I'm not sure how to create an xml file using PHP... I reckon I'd want the php to recreate this page as more reviews come in.
I have the following code in a php file.
<?php
//Get all comments
$comments = get_comments(
array(
'status' => 'approve',
'post_status' => 'publish',
'post_type' => 'product',
'parent' => 0,
'order' => 'DESC',
)
);
foreach ( (array) $comments as $comment ) :
if ( !empty($comment->comment_author) ) {
if (!empty($comment->user_id)){
$user = get_userdata($comment->user_id);
$author = ucfirst(strtolower($user->first_name)).' '.ucfirst(strtolower(substr($user->last_name,0,1))); // this is the actual line you want to change
} else {
$author_name = $comment->comment_author;
$parts = explode(" ", $author_name);
$author = ucfirst(strtolower($parts[0]).' '.(isset($parts[1]) ? ucfirst($parts[1][0]) : ''));
}
} else {
$author = __('Customer');
}
////////////////COMMENT VARIABLES
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
$rating_html = wc_get_rating_html( $rating );
$_date = get_comment_date('', $comment);
$_product = wc_get_product($comment->comment_post_ID);
$content = <<<EOT
<review>
<review_id><?php $comment->comment_ID; ?></review_id>
<reviewer>
<name><?php echo $author; ?></name>
</reviewer>
<review_timestamp><?php echo $_date; ?></review_timestamp>
<content><?php echo $comment->comment_content; ?></content>
<review_url type="group"><?php echo get_permalink($comment->comment_post_ID); ?></review_url>
<ratings>
<overall min="1" max="5"><?php echo $rating; ?></overall>
</ratings>
<products>
<product>
<product_name><?php echo $_product->get_title(); ?></product_name>
<product_url><?php echo $_product->get_permalink(); ?></product_url>
</product>
</products>
<is_spam>false</is_spam>
<collection_method>post_fulfillment</collection_method>
</review>
EOT;
endforeach; ?>
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.google.com/shopping/reviews/schema/product/2.2/product_reviews.xsd">
<version>2.2</version>
<publisher>
<name>Herbal Nitro</name>
<favicon>https://static.herbalnitro.com/wp-content/uploads/2018/07/Favicon-new.png</favicon>
</publisher>
<reviews>
<?php echo $content; ?>
</reviews>
</feed>
Any help would be tremendously helpful!
Sincerely,
Jordan
php xml wordpress feed
I am trying to submit my customer reviews to Google so I can start showing my product reviews on Google shopping.
I'm required to submit a feed that looks like this,
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.google.com/shopping/reviews/schema/product/2.2/product_reviews.xsd">
<version>2.2</version>
<aggregator>
<name>Sample Reviews Aggregator (if applicable)</name>
</aggregator>
<publisher>
<name>Sample Retailer</name>
<favicon>http://www.example.com/favicon.png</favicon>
</publisher>
<reviews>
<review>
<!-- full sample - includes all optional elements/attributes -->
<review_id>14295</review_id>
<reviewer>
<name is_anonymous="true">Anonymous</name>
<reviewer_id>509769</reviewer_id>
</reviewer>
<review_timestamp>2014-04-21T07:07:07Z</review_timestamp>
<title>Excellent</title>
<content>Got it for a friend and he loved it.</content>
<pros>
<pro>Sleek design</pro>
<pro>Protects the tablet well</pro>
</pros>
<cons>
<con>Pricey</con>
</cons>
<review_url type="singleton">http://www.example.com/review_14295.html</review_url>
<reviewer_images>
<reviewer_image>
<url>https://example.com/test.jpg</url>
</reviewer_image>
<reviewer_image>
<url>https://example.com/test.gif</url>
</reviewer_image>
</reviewer_images>
<ratings>
<overall min="1" max="5">4.4</overall>
</ratings>
<products>
<product>
<product_ids>
<gtins>
<gtin>541710238425</gtin>
</gtins>
<mpns>
<mpn>60101-10000</mpn>
</mpns>
<skus>
<sku>6206</sku>
</skus>
<brands>
<brand>Acme</brand>
</brands>
</product_ids>
<product_name>Tablet Sleeve</product_name>
<product_url>http://www.example.com/product_6206.html</product_url>
</product>
</products>
<is_spam>false</is_spam>
<collection_method>post_fulfillment</collection_method>
<transaction_id>fulfillment_transaction_11198373</transaction_id>
</review>
<review>
<!-- minimal sample - no optional elements/attributes -->
<reviewer>
<name>Jane</name>
</reviewer>
<review_timestamp>2014-04-21T07:14:21Z</review_timestamp>
<content>I was a little skeptical at first, but it grew on me.</content>
<review_url type="singleton">http://www.example.com/review_59684.html</review_url>
<ratings>
<overall min="1" max="5">4.3</overall>
</ratings>
<products>
<product>
<product_url>http://www.example.com/product_6207.html</product_url>
</product>
</products>
</review>
</reviews>
<deleted_reviews>
<review_id>10438</review_id>
</deleted_reviews>
</feed>
So I created a php file that grabs all that data and wraps it in xml, but I'm not sure how to create an xml file using PHP... I reckon I'd want the php to recreate this page as more reviews come in.
I have the following code in a php file.
<?php
//Get all comments
$comments = get_comments(
array(
'status' => 'approve',
'post_status' => 'publish',
'post_type' => 'product',
'parent' => 0,
'order' => 'DESC',
)
);
foreach ( (array) $comments as $comment ) :
if ( !empty($comment->comment_author) ) {
if (!empty($comment->user_id)){
$user = get_userdata($comment->user_id);
$author = ucfirst(strtolower($user->first_name)).' '.ucfirst(strtolower(substr($user->last_name,0,1))); // this is the actual line you want to change
} else {
$author_name = $comment->comment_author;
$parts = explode(" ", $author_name);
$author = ucfirst(strtolower($parts[0]).' '.(isset($parts[1]) ? ucfirst($parts[1][0]) : ''));
}
} else {
$author = __('Customer');
}
////////////////COMMENT VARIABLES
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
$rating_html = wc_get_rating_html( $rating );
$_date = get_comment_date('', $comment);
$_product = wc_get_product($comment->comment_post_ID);
$content = <<<EOT
<review>
<review_id><?php $comment->comment_ID; ?></review_id>
<reviewer>
<name><?php echo $author; ?></name>
</reviewer>
<review_timestamp><?php echo $_date; ?></review_timestamp>
<content><?php echo $comment->comment_content; ?></content>
<review_url type="group"><?php echo get_permalink($comment->comment_post_ID); ?></review_url>
<ratings>
<overall min="1" max="5"><?php echo $rating; ?></overall>
</ratings>
<products>
<product>
<product_name><?php echo $_product->get_title(); ?></product_name>
<product_url><?php echo $_product->get_permalink(); ?></product_url>
</product>
</products>
<is_spam>false</is_spam>
<collection_method>post_fulfillment</collection_method>
</review>
EOT;
endforeach; ?>
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.google.com/shopping/reviews/schema/product/2.2/product_reviews.xsd">
<version>2.2</version>
<publisher>
<name>Herbal Nitro</name>
<favicon>https://static.herbalnitro.com/wp-content/uploads/2018/07/Favicon-new.png</favicon>
</publisher>
<reviews>
<?php echo $content; ?>
</reviews>
</feed>
Any help would be tremendously helpful!
Sincerely,
Jordan
php xml wordpress feed
php xml wordpress feed
asked Nov 23 '18 at 21:43
PooceyPoocey
3516
3516
No, just no. You can't jam together a bunch of strings and call it XML. You need to use proper XML APIs to create the file.
– miken32
Nov 23 '18 at 22:18
Possible duplicate of How to generate XML file dynamically using PHP?
– miken32
Nov 23 '18 at 22:18
That said, I wouldn't be surprised if there were an existing library that could specifically create XML for Google's purposes.
– miken32
Nov 23 '18 at 22:21
add a comment |
No, just no. You can't jam together a bunch of strings and call it XML. You need to use proper XML APIs to create the file.
– miken32
Nov 23 '18 at 22:18
Possible duplicate of How to generate XML file dynamically using PHP?
– miken32
Nov 23 '18 at 22:18
That said, I wouldn't be surprised if there were an existing library that could specifically create XML for Google's purposes.
– miken32
Nov 23 '18 at 22:21
No, just no. You can't jam together a bunch of strings and call it XML. You need to use proper XML APIs to create the file.
– miken32
Nov 23 '18 at 22:18
No, just no. You can't jam together a bunch of strings and call it XML. You need to use proper XML APIs to create the file.
– miken32
Nov 23 '18 at 22:18
Possible duplicate of How to generate XML file dynamically using PHP?
– miken32
Nov 23 '18 at 22:18
Possible duplicate of How to generate XML file dynamically using PHP?
– miken32
Nov 23 '18 at 22:18
That said, I wouldn't be surprised if there were an existing library that could specifically create XML for Google's purposes.
– miken32
Nov 23 '18 at 22:21
That said, I wouldn't be surprised if there were an existing library that could specifically create XML for Google's purposes.
– miken32
Nov 23 '18 at 22:21
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53453231%2fcreate-xml-feed-with-php-on-wordpress-google-product-reviews%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53453231%2fcreate-xml-feed-with-php-on-wordpress-google-product-reviews%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
No, just no. You can't jam together a bunch of strings and call it XML. You need to use proper XML APIs to create the file.
– miken32
Nov 23 '18 at 22:18
Possible duplicate of How to generate XML file dynamically using PHP?
– miken32
Nov 23 '18 at 22:18
That said, I wouldn't be surprised if there were an existing library that could specifically create XML for Google's purposes.
– miken32
Nov 23 '18 at 22:21