I want to import a datafeed in PriceTapestry. If you have more then one affiliate it's lot of work to save the files en upload them to the map 'feeds'.
Is there is (simple) solution to update this automatic?
I have two sorts of files what i can import: CSV and XML.
Thanks for your reply. I look around in the topics, but i don't have shell acces etc.
I want a simple php script who can upload some affiliate xml feeds. The Feed Registration can I do manually. The only thing is that I want tot update these files regularly (daily). It is a lot of work to upload 15 xml feeds daily to the feeds folder.
Example
I have +/- 15 URL's like: http://www.123.com/feed.php?&adv=123&subid=123&type=xml
I want to upload these files (automaticly) to /feeds/
Do you have a solution for me?
Hi,
This should be possible if your /feeds/ folder can be made writable; and your PHP installation has the ability to open files over the Internet via HTTP.
The easiest way to make /feeds/ writable is normally via your FTP program. In the remote window, right-click on the /feeds/ folder and look for "Permissions..." or maybe "Properties..." and then Permissions. Then give write access to all users - owner / group / world. That will ensure that PHP can write to the /feeds/ directory.
Then, the following script would be the most basic way to fetch your remote feeds and save them in /feeds/ with the filename specified. Run this script from the /admin/ folder:
download.php
<?php
set_time_limit(0);
header("Content-Type: text/plain;");
$feeds["Merchant1.xml"] = "http://www.123.com/feed.php?&adv=1&subid=123&type=xml";
$feeds["Merchant2.xml"] = "http://www.123.com/feed.php?&adv=2&subid=123&type=xml";
$feeds["Merchant3.xml"] = "http://www.123.com/feed.php?&adv=3&subid=123&type=xml";
foreach($feeds as $filename => $url)
{
print $filename."\n";
copy($url,"../feeds/".$filename);
}
print "Done.";
?>
There is a much more comprehensive download script in the following thread:
http://www.pricetapestry.com/node/24
However give the above script a go first (remember to run it from the /admin/ folder) and if it's not working i'll help you with debug code and then to build it up into the script from the other thread...
Cheers,
David.
Hi David,
I made the /feeds/ folder writable. And I put the download.php in de /admin/ folder.
When I want to run the script, I get these errors:
Warning: set_time_limit() has been disabled for security reasons in /home/****/public_html/admin/download.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at /home/****/public_html/admin/download.php:2) in /home/****/public_html/admin/download.php on line 3
feeds.xml Done.
Hi,
Both of these warnings are a result of the same thing. Because set_time_limit() is disabled on your server this generates the first warning; and as a result of that output being generated by PHP the header() function can't operate. To fix this, simply remove the following line from the script;
set_time_limit(0);
...as since it is disabled it won't make any difference; however this will of course have an impact on the size / number of feeds you will be able to download in one file.
With that removed; check that the script is working as expected and the feed appears in /feeds/ after running the script. Don't forget to delete the file if it already exists in /feeds/ in order to make sure that it is working...
Cheers,
David.
Hi aff123, welcome to the forum!
Check the following page for lots of info and discussion regarding automation...
http://www.pricetapestry.com/node/198
If you want any help with any specific part of automation just let me know - i.e. downloading / uploading, the import itself etc...
Cheers,
David.