Hi; I'm a newbie. Im trying to do this code:
PHP Code:
<?php $vidlink = 'http://www.yourdomain.com/'; $str=file_get_contents($vidlink); $fulltype = '.html'; $b = "1"; $filename = $b.$fulltype; file_put_contents($b.$fulltype, $str); chmod($filename, 0777); $somecontent = "\nSomething here\n";
// Let's make sure the file exists and is writable first. if (is_writable($filename)) {
if (!$handle = fopen($filename, 'r+')) { echo "Cannot open file ($filename)"; exit; }
// Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; }
echo "Success";
fclose($handle);
} else { echo "The file $filename is not writable"; } ?>
I want to add a content in the beginning of the page but it always cut down the
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
and it appears as
Code:
My new content TML 4.01 Transitional//EN">
thats why the page is broken...
Can you please help me so it doesnt cut down the first doctype of the page when i add a new content.
Thanks in advance
P/s: seems like it always overwrite the doctype line... if i try to write it at the bottom of the page then it is fine.
|