0

This code is working

$content = file_get_contents('http://www.professor-oak.com/cardorders/ItemDetails.asp?IID=' . $row['POID']);
preg_match('#<span itemprop="price">(.*)</span>#', $content, $match);
$price = $match[1];

but this is not

$content = file_get_contents('http://www.trollandtoad.com/p1062197.html');
preg_match('#</div><div class="priceSection">$(.*)</div></div>#', $content, $match);
$price2 = $match[0];
echo $price;

and for the life of me i cannot figure out why.

I have tested the link and tested that information is being retrieved; both are working.

but i cannot get it to preg_match. I am not running them on the same page.

  • `$` is a regex metacharacter that matches the end of line. Backslash it if you want to match a literal dollar sign. – hobbs Jan 17 '15 at 20:20
  • 1
    [Don't parse HTML with regex!](http://stackoverflow.com/a/1732454/418066) – Biffen Jan 17 '15 at 20:22

0 Answers0