Hello,
I would like to ask you for this issue: I have made this php:
PHP Code:
<?php
//include parseru
include('simple_html_dom.php');
//read parsovany stranky
$html = file_get_html('http://www.webpage1.com/123456');
//find Weight
$DC1 = $html->find('tr[id=product-details-weight]', 0)->plaintext;
//split(tady to bude podle dvojtecky)
$w = explode(':', $DC1);
$BM1 = trim($w[1]);
//find Shape
$DC2 = $html->find('tr[id=product-details-shape]', 0)->plaintext;
//split(tady to bude podle dvojtecky)
$w = explode(':', $DC2);
$BM2 = trim($w[1]);
//find Color
$DC3 = $html->find('tr[id=product-details-color]', 0)->plaintext;
//split(tady to bude podle dvojtecky)
$w = explode(':', $DC3);
$BM3 = trim($w[1]);
etc etc
//echo:
echo ''.$BM1.','.$BM2.','.$BM3.',etc,etc'';
//create file
$myFile = "RESULTS.csv";
$fh = fopen($myFile, 'w') or die("can't open file");
//header
$stringData = "Weight,Shape,Color,etc,etc";
//write
fwrite($fh, $stringData);
//Insert data to .csv
$stringData = "$BM1,$BM2,$BM3,etc,etc";
fwrite($fh, $stringData);
?>
This .php reads example URL (
http://www.webpage1.com/123456) and create RESULTS.csv with data on it (2 rows). I would like to improve it that it would read URLs from specific .csv, so it would write everything i need in RESULTS.csv.
For example: in file URLS.csv is 50 different webpages, so in file RESULTS.csv will be 50 rows with data + 1 row as a header. If file URLS.csv will be changed to 65 urls, as a result will be file with 66 rows... etc...
I hope you are understanding me... (i am sorry for my bad english)
With kind regards.... S.