This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
tesco_scraper [2022/05/02 14:26] admin |
tesco_scraper [2022/05/02 14:38] (current) admin |
||
|---|---|---|---|
| Line 48: | Line 48: | ||
| } | } | ||
| - | $lines = array('Product Name', 'Tesco URL', 'Brand', 'Price', 'Price per unit', 'Unit Measure'); | + | $lines = array(); |
| + | $lines[] = array('Product Name', 'Tesco URL', 'Brand', 'Price', 'Price per unit', 'Unit Measure'); | ||
| // read through each of the pages, parse the json and output as csv | // read through each of the pages, parse the json and output as csv | ||
| echo "Parsing JSON to CSV\n"; | echo "Parsing JSON to CSV\n"; | ||
| Line 83: | Line 84: | ||
| fputcsv($fp, $line); | fputcsv($fp, $line); | ||
| } | } | ||
| + | |||
| </code> | </code> | ||
| Line 96: | Line 98: | ||
| Writing CSV | Writing CSV | ||
| </code> | </code> | ||
| + | |||
| + | {{:pasted:20220502-153759.png}} | ||