Page 1 of 1

Search content in a webpage?

Posted: Thu Jan 31, 2013 3:57 pm
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

Re: Search content in a webpage?

Posted: Thu Jan 31, 2013 8:15 pm
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.