Search content in a webpage?

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
Akalyptos21
Forum Newbie
Posts: 1
Joined: Thu Jan 31, 2013 3:43 pm

Search content in a webpage?

Post by Akalyptos21 »

Hey guys,
I am totally lost here.

Can anyone help me with a php code.
I wanna search for specific text strings in a webpage which i have predefined before and store them in a database.
Lets just say that i am looking for the name "jonh" in a webpage and store only the last names which always follows.
Is that possible?

Thanks in advance
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Search content in a webpage?

Post by Christopher »

Take a look at preg_match() with the PREG_OFFSET_CAPTURE flag. That will get you the position of all the matches. From there you can get to nearby text.
(#10850)
Post Reply