So, I have a website in which I gather data directly from another associated website, in order to display information. To do this, I am fetching the website (using file_get_contents) and stripping out anything not relevant using eregi. My problem is that even though I've done thourough research on how to convert this eregi to a not deprecated preg_match, I can not seem to find a solution.
Anyone bright enough to understand the complexities of preg_match?
Here's my current code:
$content = file_get_contents("http://www.vattenfall.se/sv/teckna- elavtal.htm/papp/mac:24432/ma-vf_se-orderflow/ProductSelection.action?orderMode=true&submitPostalCode=&orderFlow.personal.postalCode=87140&submitPostalCode=Visa+priser");
eregi('<td style="width: 120px;" class="valuePresentation">(.*)</td>', $content, $data);
foreach($data as $split)
{
$split = explode("</td>", $split);
}
This works fine - but as I said, the function is deprecated, and I would love to replace it, if only I knew how!
eregi('some expression', $input, $matches);
dark magic, chanting, spooky things...
preg_match('/some expression/i', $input, $matches);
You might want preg_match_all()
instead, though.