Req #65975 [Opn->Fbk]: SimpleXML strips off URL affiliate tag
| From: | cmb@php.net | Date: | Thu, 29 Mar 2018 17:51:12 +0000 |
| Subject: | Req #65975 [Opn->Fbk]: SimpleXML strips off URL affiliate tag | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214531@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65975&edit=1
ID: 65975
Updated by: cmb@php.net
Reported by: donfelipe2009 at yahoo dot com
Summary: SimpleXML strips off URL affiliate tag
-Status: Open
+Status: Feedback
Type: Feature/Change Request
Package: SimpleXML related
Operating System: Chrome and IE8 on Windows XP
PHP Version: 5.4.21
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with ,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Note that the amazon URI does not work anymore.
Previous Comments:
------------------------------------------------------------------------
[2013-10-27 14:26:22] donfelipe2009 at yahoo dot com
The test script below was also written as stated below and tested at http://www.compileonline.com/execute_php_online.php:
<html>
<head>
<title>Online PHP Script Execution</title>
</head>
<body>
<?php
$amazontag = '?tag=digitaundivi-20';
$html = "";
$url = "http://www.amazon.com/rss/tag/video%20games/recent?tag=digitaundivi-20";
$xml = simplexml_load_file($url);
for($i = 0; $i < 10; $i++){
$title = $xml->channel->item[$i]->title;
$link = $xml->channel->item[$i]->link;
$link .= trim($amazontag);
$description = $xml->channel->item[$i]->description;
$pubDate = $xml->channel->item[$i]->pubDate;
$html .= "<a href='$link'><h3>$title</h3></a>";
$html .= "$description";
$html .= "<br />$pubDate<hr />";
}
echo $html;
?>
</body>
</html>
NOTE: It is very important that the URL of the images contain the '?tag=digitaundivi-20'
because visitors to the website usually click on the images.
The following RSS feed is correctly created by BlastCasta with
'?tag=digitaundivi-20'included in all the URLs: http://poshhub.com/best-selling-video-games.html
------------------------------------------------------------------------
[2013-10-27 14:04:32] donfelipe2009 at yahoo dot com
Description:
------------
The URL to be parsed is http://www.amazon.com/rss/tag/video%20games/recent?tag=digitaundivi-20"
SimpleXML strips off the affiliate tag: ?tag=digitaundivi-20, of the $title and the hyperlinks in
the CDATA. The CDATA is in the $description. Therefore, after executing the command 'echo
$html;', the hyperlinks for images, 'Buy new', and 'used and new',
doesn't have the tag: ?tag=digitaundivi-20
But the hyperlinks for 'Customer tags:' do have the tag: ?tag=digitaundivi-20
Please help. I am hoping for a simple solution. The tag: ?tag=digitaundivi-20 in the URL is needed
for amazon.com to know who sent the traffic.
The Test script can be tested at http://www.compileonline.com/execute_php_online.php
Mr. Morgan
Test script:
---------------
<?php
$html = "";
$url = "http://www.amazon.com/rss/tag/video%20games/recent?tag=digitaundivi-20";
$xml = simplexml_load_file($url);
for($i = 0; $i < 10; $i++){
$title = $xml->channel->item[$i]->title;
$link = $xml->channel->item[$i]->link;
$description = $xml->channel->item[$i]->description;
$pubDate = $xml->channel->item[$i]->pubDate;
$html .= "<a href='$link'><h3>$title</h3></a>";
$html .= "$description";
$html .= "<br />$pubDate<hr />";
}
echo $html;
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65975&edit=1