I have this code to get the HTML source of a website/file and replace some parts of its content. Later I print the modified result
<?php
// Get a file into an array. In this example we'll go through HTTP to get
// the HTML source of a URL.
$lines = file($link);
// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
}
?>
<?php
$old = array("document.write(", "'", ")", "<a href="", "</a>", "target="_blank"");
$new = array("", "", "", "", "", "");
$original = htmlspecialchars($line);
$changed = str_replace($old, $new, $original);
?>
This code is in a file, I include this code using <?php include('newfile.php'); ?>
For some reason any other file after I include that file will not work, like <?php include('somefile.php'); ?>
or <?php get_footer(); ?>
Any help will be appreciated Sorry for my English
Daniel
I got this: Notice: Undefined variable: do_not_duplicate in /usr/local/pem/vhosts/135377/webspace/httpdocs/folder/wp-content/themes/one/index.php on line 47 Warning: in_array(): Wrong datatype for second argument in /usr/local/pem/vhosts/135377/webspace/httpdocs/folder/wp-content/themes/one/index.php on line 47
The error message has nothing to do with the code provided before, the error message has someting to do with Wordpress, on line 47 is this code: <?php while (have_posts()) : the_post(); if (in_array($post->ID, $do_not_duplicate)) continue; ?><li class="contentli">
Update 1
Error message says:
Parse error: syntax error, unexpected $end in /usr/local/pem/vhosts/135377/webspace/.../newfile.php(26) : eval()'d code on line 1
Parse error: syntax error, unexpected $end in /usr/local/pem/vhosts/135377/webspace/.../newfile.php(30) : eval()'d code on line 1
Fatal error: Cannot break/continue 1 level in /usr/local/pem/vhosts/135377/webspace/.../newfile.php on line 32
Update 2
There is no error message but the content of the footer (<?php get_footer(); ?>
) is on the source code of the site but not visible to users. (If I check the source code of the site i can find all the elements of the footer file, but these elements aren't properly rendered on the browser)