Hello all,
I'm quite a newbie to the php language. But was hoping after more than a few hours of search online if someone could help me with the following with some working sample code:
1. I have a website that I want to parse/scrape.
2. I have a text pattern.
Question:
1. Does anyone have an working sample code that I can take a look at?
any help would be appreciated.
How to: Web Scrape/ Parse a website and return content
Moderator: General Moderators
Re: How to: Web Scrape/ Parse a website and return content
You could try
I've seen it used before to get web site code and parse it. If that's what you're after. I think the only limitation is that the PHP server option allow_url_fopen must be on for this to work.
The alternative (although I've never done this) which I turned up through 1 google search, is to use Curl.
http://wiki.dreamhost.com/index.php/CURL
Code: Select all
$page_content = file_get_contents('http://www.url-here.tld');
...#parsing code here
The alternative (although I've never done this) which I turned up through 1 google search, is to use Curl.
http://wiki.dreamhost.com/index.php/CURL