<?php
$url="http://somedomain/something";
$lines = file('text.txt');
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />
";
$dom = new DOMDocument;
$dom->loadHTMLFile($url.$line); //cannot load this
foreach ($dom->getElementsByTagName('p') as $node) {
// do stuff with $node
echo $node->nodeValue, "
";
}
}
fclose($handle);
?>
I would like to attach the url to the lines of the text file:
Example
$url.$line1 (http://somedomain/something/line1
)
$url.$line2 (http://somedomain/something/line2
)
I have succesfully set up everything and the loop works well too. But whenever I try to concatenate the url with the line an HTTP 500 Error is returned
Also these characters '%0D%0A' attch themselves to end of the $url.$line and hence the error?
Any help appreciated
Update: The error is because of the '%0D%0A' characters somehow attaching themselves to the end of each url. Any idea how to remove them?