0

I'm using cURL to get page source. It works great, but when I use

echo '<pre>';
    print_r($source);
echo '</pre>';

to display as text only, the page gets parsed and I end up seeing it as a webpage instead of plain text.

How can I view the remote page as text only?

1 Answer 1

5

Your HTML needs to be escaped in what you are outputting, example:

echo '<pre>';
print(htmlspecialchars($source));
echo '</pre>';
Sign up to request clarification or add additional context in comments.

2 Comments

Will this safely display ALL code as text no matter what's on the other end of the connection? Image, redirect headers, malicious files or executables?
I'm not aware of any way to inject something malicious into that.

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.