<?
// Make array of URLs to work with
$URLs = array(
'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB',
'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB',
'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB'
);
// Loop through each array and store the prices in arrays
foreach ($URLs as $URL) {
$working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.working dd" cache="0" rem_tags="script, style" newtab="false"]');
$not_working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.not_working dd" cache="0" rem_tags="script, style" newtab="false"]');
}
// Open the file "zonzoo.csv" for writing
$file = fopen('zonzoo.csv', 'w');
// Save the column headers
fputcsv($file, array('ID', 'NAME', 'CATEGORY', 'BRAND', 'PRICE', 'DEEPLINK', 'IMAGE', 'SHIPPING'));
// Sample data. This can be fetched from MySQL too
$data = array
(
array(1, 'iPhone 4 16GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0),
array(2, 'iPhone 4 32GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0),
array(3, 'iPhone 4 8GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0)
);
// Replace the prices of working mobile phones
$i = 0;
foreach ($working as $price_working) {
$data[$i][4] = $price_working;
$i++;
}
// Replace the prices of not-working mobile phones
$x = 0;
foreach ($not_working as $price_not_working) {
$data[$x][7] = $price_not_working;
$x++;
}
// Save each row of the data
foreach ($data as $row) {
fputcsv($file, $row);
}
// Close the file
fclose($file);
?>
<?
// Make array of URLs to work with
$URLs = array(
'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB',
'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB',
'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB'
);
// Loop through each array and store the prices in arrays
foreach ($URLs as $URL) {
$working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.working dd" cache="0" rem_tags="script, style" newtab="false"]');
$not_working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.not_working dd" cache="0" rem_tags="script, style" newtab="false"]');
}
// Open the file "zonzoo.csv" for writing
$file = fopen('zonzoo.csv', 'w');
// Save the column headers
fputcsv($file, array('ID', 'NAME', 'CATEGORY', 'BRAND', 'PRICE', 'DEEPLINK', 'IMAGE', 'SHIPPING'));
// Sample data. This can be fetched from MySQL too
$data = array
(
array(1, 'iPhone 4 16GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0),
array(2, 'iPhone 4 32GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0),
array(3, 'iPhone 4 8GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0)
);
// Replace the prices of working mobile phones
$i = 0;
foreach ($working as $price_working) {
$data[$i][4] = $price_working;
$i++;
}
// Replace the prices of not-working mobile phones
$x = 0;
foreach ($not_working as $price_not_working) {
$data[$x][7] = $price_not_working;
$x++;
}
// Save each row of the data
foreach ($data as $row) {
fputcsv($file, $row);
}
// Close the file
fclose($file);
?>
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
<?
// Make array of URLs to work with
$URLs = array(
'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB',
'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB',
'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB'
);
// Loop through each array and store the prices in arrays
foreach ($URLs as $URL) {
$working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.working dd" cache="0" rem_tags="script, style" newtab="false"]');
$not_working[] = do_shortcode('[wpwg url="' . $URL . '" selector=".price-quote.not_working dd" cache="0" rem_tags="script, style" newtab="false"]');
}
// Open the file "zonzoo.csv" for writing
$file = fopen('zonzoo.csv', 'w');
// Save the column headers
fputcsv($file, array('ID', 'NAME', 'CATEGORY', 'BRAND', 'PRICE', 'DEEPLINK', 'IMAGE', 'SHIPPING'));
// Sample data. This can be fetched from MySQL too
$data = array
(
array(1, 'iPhone 4 16GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1023/Apple+iPhone+4+16GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0),
array(2, 'iPhone 4 32GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1024/Apple+iPhone+4+32GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0),
array(3, 'iPhone 4 8GB', 'Mobiel', 'Apple', 0, 'http://zonzoo.nl/uw-telefoons-verkopen/1272/Apple+iPhone+4+8GB', 'http://www.fonebank.com/images/uploads/handsets/apple-iphone-4-ofic-final.jpg', 0)
);
// Replace the prices of working mobile phones
$i = 0;
foreach ($working as $price_working) {
$data[$i][4] = $price_working;
$i++;
}
// Replace the prices of not-working mobile phones
$x = 0;
foreach ($not_working as $price_not_working) {
$data[$x][7] = $price_not_working;
$x++;
}
// Save each row of the data
foreach ($data as $row) {
fputcsv($file, $row);
}
// Close the file
fclose($file);
?>
Fatal error: Uncaught Error: Call to undefined function do_shortcode() in /in/KhPNM:12
Stack trace:
#0 {main}
thrown in /in/KhPNM on line 12
Process exited with code 255.