When I output the data (string) of a php variable through javascript (client side) document.write() function, the string isn't output completely, rather only 152 characters are written.
In usual string which I assign manually, I don't get this error.
like when I write
<?php
$code = '5i9ZXI"5"EdNI7LMV_"Hk_nmJBJ2kkXaaxIRTkxJkQvPEvZGmMuPsHPQ2fBujjMxZ1TBYhp80ek2rZ4_vAGgQUUuET272kpy1gfTqZm3z3pa4FOzng"aNIGIIef6bPRVBOAmXOyFVLSFbyVpS5wvTxoP';
echo $code;
?>
<script>
document.write('<?php echo $code; ?>');
</script>
I get the same text which is stored in $code;
But when I do it the other way.. I search & grab the code from a page's source code, and then output the code thorugh javascript, only 152 characters are returned.
<?php
function grab_link ($url, $match) {
$fp = fopen($url, "r") or die("Could not contact $url");
$page_contents = "";
while ($new_text = fread($fp, 8000)) {
$page_contents .= $new_text;
}
echo $match_result = preg_match_all($match, $page_contents, $match_array, PREG_SET_ORDER);
foreach ($match_array as $entry) {
$linkda_dec = $entry[1];
print("<B>linkda_dec = </B>: $linkda_dec");
}
return $linkda_dec; // returning any code that was found
}
$match = "/\sbase64ToText\s\s(\s'([']+)'/i";
$code = grab_link("http://www.sendspace.com/file/llzx8l", $match);
echo $code."<br>";
?>
<script>
var linkda = '<?php echo $code; ?>';
document.write(linkda);
</script>
Here the output from the 'echo' function is returning the complete string but 'document.write' function outputs just 152 characters.
Please! somebody help me sorting out the problem..
Thanks! in advance.