1

I need to extract some data from html:

I have some html like this:

<div class="class"><b>Brand:</b> Apple &nbsp; &nbsp;<b>Model:</b> iPhone 5 &nbsp; &nbsp;</div>

I need to extract something like this:

Brand => Apple Model => iPhone

How I can achieve do this?

this is my current code

preg_match_all("#<b>(.*?)<\/b>+(.*?)#im", $content['adoptions'], $matches);
greenbandit
  • 2,267
  • 5
  • 30
  • 44
  • See [How do you parse and process HTML/XML in PHP?](http://stackoverflow.com/q/3577641) for a more concrete reference than the joke-answer-kept-for-historic-reasons. – mario Aug 05 '14 at 04:49

1 Answers1

1

Probably not the best idea to be parsing HTML with regex. Perhaps give a HTML parser like http://simplehtmldom.sourceforge.net/ a go.

Dave Cooper
  • 10,494
  • 4
  • 30
  • 50