how do I read a website's source code line by line
and store it as string for modification??

Recommended Answers

All 2 Replies

<?php
// the HTML source of a URL.
$lines = file('http://www.google.com/');

// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
    echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
}
?>

thank you so much
I try it out and it works perfectly

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.