I have been try to do this sussefully (forever) can someone please help me I know there is google but Some of the tutorails I follow are confusing or there is errors in the code. Can someone give me and example, show me a tutorail, or just show me how to do it. Sincerly, Andrea
When you say "scrape", I'm assuming you mean scrape something from a web page? $htmlPattern = '/<span id="lblVenta" class="cifras" style=".+">(\d+\.\d+)<\/span>/'; I just had to do this - scrape the Costa Rican colon (¢) exchange rate from the central bank's web site - it's not available in real time anywhere else that I could find (rss, etc). So, out of all the tags on the page, the ones that are around the data I need have their own css class attached to them, so that's the unique identifier for the data. For example, if today's "sell" rate ("venta" in spanish) is 552.33 colones (per US dollar), then the tag on the site will look like this: so the code to scrape it is: Of course, scraping it live slows down your own web site, especially since we're loading the whole page first - so for this example you'd want it running as a cron job and dump just the data into a file to be read as needed.
If it's like the above poster, use str_repace() then. $page = file_get_contents('url'); $page = str_replace('search', '', $page); If you require regex, use preg_replace() instead.
I've used file() in the past to read a page from a website. Here's a sample of it in use: pictureinthesky.net/utils/ripper.php