Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Jun 2011
    Thanked 0 Times in 0 Posts

    Exclamation Read URLs from csv


    I would like to ask you for this issue: I have made this php:

    PHP Code:
    //include parseru

    //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 ''.$BM1.','.$BM2.','.$BM3.',etc,etc'';

    //create file
    $myFile = "RESULTS.csv";
    $fh = fopen($myFile, '
    w') or die("can't open file");

    $stringData = "Weight,Shape,Color,etc,etc";

    //Insert data to .csv
    $stringData = "$BM1,$BM2,$BM3,etc,etc";

    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.
    Last edited by Scharfheimlich; 08-25-2012 at 09:57 PM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts