Daniel Tovesson
Daniel Tovesson

Reputation: 2590

Find word and return whole line

I use file_get_contents("http://www.mydomain.com"); to get the content. Then I need to search through it for a word and return the whole line where the word is found. Is this possible?

Upvotes: 1

Views: 260

Answers (1)

Jarosław Gomułka
Jarosław Gomułka

Reputation: 4995

Iterate over each line in content.

Use strpos to check if line contains word that you are looking for.

Upvotes: 2

Related Questions