1

I am using php to get the contents of a webpage:

$fileContent = file_get_contents('http://insertwebsitenamehere.com');

Is there a way to seek a line number andreturn the line at that location?

I know you can use SplFileObject::Seek if the fileContent is a file. Can I perform something similar without the need to turn it into a file?

1 Answer 1

1

You want file() instead

$fileContent = file('http://insertwebsitenamehere.com');
echo $fileContent[39]; //line 40
Sign up to request clarification or add additional context in comments.

1 Comment

This is what I was looking for! Thank-you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.