Selective content extraction--Help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
snavudu
Forum Newbie
Posts: 1
Joined: Thu Jan 16, 2003 1:16 pm

Selective content extraction--Help

Post 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
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post 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.
Post Reply