I am having a problem with substr() working when I enter the third
perimeter. I am working on a price monitoring project that will
download data from Amazon.com. After is downloads the page, it strips
the tags, then is supposed to give me only the price data by using
substr().
Below is my code:
<?php
include("LIB_ht tp.php");
include("LIB_pa rse.php");
$product_array= array();
$product_count= 0;
$target = "http://www.amazon.com/gp/offer-listing/0324319169/
ref=dp_olp_2?ie =UTF8&qid=12227 03415&sr=11-1";
$web_page = http_get($targe t, "");
//Parse the data from the product table
$row_array = parse_array($we b_page['FILE'], "result", "</tbody>");
echo "$row_array[1] <br<br<br>";
//Get the price data
$row = strip_tags($row _array[1]);
echo "$row<br<br<br> ";
$row = substr($row,9,9 );
echo $row";
?>
The interesting part about this is that substr() will work with only
two perimeters. It will return the data from the position specified
and the rest of the string. The third perimeter is supposed to allow
me to specify a certain number of characters in the string to return
instead of returning the rest of the string. Can anyone help?
perimeter. I am working on a price monitoring project that will
download data from Amazon.com. After is downloads the page, it strips
the tags, then is supposed to give me only the price data by using
substr().
Below is my code:
<?php
include("LIB_ht tp.php");
include("LIB_pa rse.php");
$product_array= array();
$product_count= 0;
$target = "http://www.amazon.com/gp/offer-listing/0324319169/
ref=dp_olp_2?ie =UTF8&qid=12227 03415&sr=11-1";
$web_page = http_get($targe t, "");
//Parse the data from the product table
$row_array = parse_array($we b_page['FILE'], "result", "</tbody>");
echo "$row_array[1] <br<br<br>";
//Get the price data
$row = strip_tags($row _array[1]);
echo "$row<br<br<br> ";
$row = substr($row,9,9 );
echo $row";
?>
The interesting part about this is that substr() will work with only
two perimeters. It will return the data from the position specified
and the rest of the string. The third perimeter is supposed to allow
me to specify a certain number of characters in the string to return
instead of returning the rest of the string. Can anyone help?
Comment