Page 1 of 1

Selective content extraction--Help

Posted: Thu Jan 16, 2003 1:16 pm
by snavudu
Hi All!
I am a real newbie to PHP so please excuse me.
I am trying to extract from this website
http://www.smarterliving.com/air/search ... php?id=127
This has all the latest travel deals from NY.
I need just the first 4 deals on that page.
How will I write a script in PHP to break at the 4th line just to get only the first 4 deals?
I am not planning to use any db for this.
Could somebody give me some pointers or sent me a sample code.
Thanks
Pilla

Posted: Thu Jan 16, 2003 2:30 pm
by llimllib
Ok, let me see if I can help.

First, you're going to want to use the file() command to read in the webpage as a file. Once you have it read into memory, you're going to want to use regular expressions to pull out the information you need. Now, regular expressions are complicated, so be ready to spend some serious time learning them. I suggest you google "perl regular expressions tutorial" or something similar to learn how to use them.

While nobody will write your script for you, I suggest that if you hit a stumbling block, you post your problem to the board, and we'll do our best to help you with it.