By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,347 Members | 1,390 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,347 IT Pros & Developers. It's quick & easy.

Problem with substr()

P: n/a
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_http.php");
include("LIB_parse.php");
$product_array=array();
$product_count=0;

$target = "http://www.amazon.com/gp/offer-listing/0324319169/
ref=dp_olp_2?ie=UTF8&qid=1222703415&sr=11-1";
$web_page = http_get($target, "");

//Parse the data from the product table
$row_array = parse_array($web_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?
Oct 1 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Oh, by the way, I am running PHP 5.2.6
Oct 1 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.