I need help with my PHP code.
We have an e-commerce site made with wordpress and woocommerce. The site needs to import products from another site's CSV-file through a datafeed.
The datafeed setup requires a PHP-file in the website's file system and a Cron Job that executes the PHP-file.
The PHP-file takes the data from 5dkmiglm.csv (cdn.sandberg.world) and appends it to pricelist_206876.csv (in our system)
These two CSV files differ in number of columns.
5dkmiglm.csv has these columns that should be imported to our pricelist:
- Partno
- Name
- Weight
- Width
- Height
- SE:retailPriceIncVat
- sv:CategoryName
The PHP-code looks like this:
`<?php
$current = file_get_contents("https://cdn.sandberg.world/feeds/5dkmiglm.csv");
$pricefile = "/pricelist_206876.csv";
file_put_contents($pricefile,$current);
?>`
I placed the PHP-file in the same folder as the pricelist that needs to be updated but nothing happens. pricelist_206876 is not updated as it should be.
The Cron Job is not in the wp-admin panel, but in the control panel (DirectAdmin) of our web host Inleed. The Cron Job command looks like this: /usr/bin/php -q /dev/null "/home/goffero/domains/goffero.com/datafeedcode.php"
I tried modifying the PHP code in various ways with no result. realpath() didn't work.
I changed the write/read/execute system permissions for the files but that didn't solve the problem.