\n"; if (preg_match('/Plot Outline:\<\/b\> (.*) \ (.*) \\n(.*)\n\/U', $raw, $matches)) { /* fixme */ $xml .= "\t$matches[1]\n"; $imdb['runtime'] = $matches[1]; } if (preg_match('/Country:\<\/b\>\n.*"\>(.*)\<\/a\>/U', $raw, $matches)) { $xml .= "\t$matches[1]"; $imdb['country'] = $matches[1]; } if (preg_match('/Language:\<\/b\>\n.*"\>(.*)\<\/a\>/U', $raw, $matches)) { $xml .= "\t$matches[1]\n"; $imdb['language'] = $matches[1]; } if (preg_match('/User Rating:\<\/b\>.*\(.*)\/10\<\/b\>/sU', $raw, $matches)) { $xml .= "\t$matches[1]\n"; $imdb['rating'] = $matches[1]; } if(preg_match('/Created by\<\/b\>.*"\>(.*)\<\/a\>/sU', $raw, $matches)) { $xml .= "\t$matches[1]\n"; $imdb['createdby'] = $matches[1]; } if(preg_match('/Genre:\<\/b\>(.*)\\/sU', $raw, $matches)) { $xml .= "\t\n"; foreach(split('/', $matches[1]) as $genre) { if(preg_match('/\>(.*)\$matchess[1]\n"; $imdb['genre'][] = $matchess[1]; } } } $xml .= "\t\n"; } if(preg_match('/\/sU', $raw, $matches)) { $xml .= "\t\n"; foreach(split('a href', $matches[2]) as $cast) { if(preg_match('/"\>(.*)\<\/a\>.*\(.*)\<\/td\>/U', $cast, $matchess)) { if($matchess[1] != '(more)') { $xml .= "\t\t\n\t\t\t$matchess[1]\n\t\t\t$matchess[2]\n\t\t\n"; $imdb['cast'][$matchess[1]] = $matchess[2]; } } } $xml .= "\t\n"; } $xml .= ""; $sxml = simplexml_load_string($xml); /* $sxml is an simplexml object you can now do shit on */ print_r($sxml->asXML()); print_r($imdb); ?> EXAMPLE OUTPUT: Sydney Bristow is an international spy recruited out of college and trained for espionage and self-defense. Spying. Stealing. Murder. And You Think Your Family Has Issues. 42 min / USA:60 min (including commercials) USA English J.J. Abrams Adventure Action Sci-Fi Thriller Mystery Jennifer Garner Sydney Bristow Ron Rifkin Arvin Sloane Michael Vartan Michael Vaughn Bradley Cooper William 'Will' Tippin (2001-2003) Carl Lumbly Marcus Dixon Merrin Dungey Francine 'Francie' Calfo/Allison Doren (2001-2003) Kevin Weisman Marshall Flinkman David Anders Julian Sark (2002-2004) Melissa George Lauren Reed (2003-2004) Mía Maestro Nadia Santos (2005-) Greg Grunberg Eric Weiss Lena Olin Irina Derevko (2002-2003) Victor Garber Jack Bristow Cass Asher German SD-6 Agent Schwartz Array ( [plot] => Sydney Bristow is an international spy recruited out of college and trained for espionage and self-defense. [tagline] => Spying. Stealing. Murder. And You Think Your Family Has Issues. [runtime] => 42 min / USA:60 min (including commercials) [country] => USA [language] => English [createdby] => J.J. Abrams [genre] => Array ( [0] => Adventure [1] => Action [2] => Sci-Fi [3] => Thriller [4] => Mystery ) [cast] => Array ( [Jennifer Garner] => Sydney Bristow [Ron Rifkin] => Arvin Sloane [Michael Vartan] => Michael Vaughn [Bradley Cooper] => William 'Will' Tippin (2001-2003) [Carl Lumbly] => Marcus Dixon [Merrin Dungey] => Francine 'Francie' Calfo/Allison Doren (2001-2003) [Kevin Weisman] => Marshall Flinkman [David Anders] => Julian Sark (2002-2004) [Melissa George] => Lauren Reed (2003-2004) [Mía Maestro] => Nadia Santos (2005-) [Greg Grunberg] => Eric Weiss [Lena Olin] => Irina Derevko (2002-2003) [Victor Garber] => Jack Bristow [Cass Asher] => German SD-6 Agent Schwartz ) )