Can someone tell me where is the problem ?

<script type="text/javascript" src="http://www.forumistan.net/analiz/analiz.php?site=http://www.forumistan.net"></script>

analiz.php

<?
Header("content-type: application/x-javascript");
ob_start();
include 'all.php';
ob_end_clean();
echo "document.write(\"<div class=\"txt\">Pagerank: $rank->pagerank <br>\")";
echo "document.write(\"Alexa: $rank->alexa_rank</div>\")";
?>

try:

echo "document.write(\"<div class=\"txt\">Pagerank: ".$rank->pagerank." <br>\")";
echo "document.write(\"Alexa: ".$rank->alexa_rank."</div>\")";

in the PHP-code.
If it doesn't help then open that JS directly in your browser and tell us the error-reporting.

I tried it, but still it is a blank...

I see you are using ob_end_clean() - that clears the Output buffers and turns off output buffering. I am not sure, but that might mean that your include 'all.php'; will not be used at all.

Try removing that line - ob_end_clean(); - and then at the very end of your code on that page, have ob_end_flush(); The OB functions are for Output Buffering - ob_start() holds all php output in the buffer until it receives the ob_end_flush() command. Then is sends all the output to the browser and clears the buffer. ob_end_clean() just clears the buffers without sending the contents to the browser.

Try this:

<?[B]PHP[/B]
Header("content-type: application/x-javascript");
ob_start();
include 'all.php';
ob_end_clean();
echo "document.write(\"<div class=\"txt\">Pagerank: $rank->pagerank <br>\")";
echo "document.write(\"Alexa: $rank->alexa_rank</div>\")";
?>

Problem is at the first line. I think. Maybe.

try using a different content type like text/javascript.

and capitalizing the php start tag does nothing.

I did not mean capitalizing php start tag. I mean "FULL" php start tag "<?php" because XML files has the same start tag "<?xml".

ok, sorry. i saw the capitalized PHP in red and thought you meant to capitalize it. i didn't see s/he didn't use the full start tag in the original post.

this is a short script file in php that works
file:: script.js.php

<?php header ('content-type: text/javascript');
ob_start("ob_gzhandler"); ?>
function newuntill(date) { 
 var newimg = "./images/new.gif";
 var expdate = new Date(date);
 var curdate = new Date();
 if (expdate.getTime() > curdate.getTime())  { 
 document.write('<img align="left" src=' + newimg + '>'); 
 } 
 else {
 document.write('');
 }
}
function movein(which,html) {
 which.style.background='turquoise'
window.status=html
 }
function moveout(which) { 
which.style.background='#d4d0c8' 
window.status=''
 }
<?php ob_flush(); ?>

header ('content-type: application-x, .........
looks for an external handler,
javascript is supposed to run in the browser

gzhandler, compresses the files before sending

"<script type="text/javascript" src="http://www.forumistan.net/analiz/analiz.php?site=http://www.forumistan.net"></script>"

that's not the right way to do it.. the code above does not call an external javascript

Dont believe it
this is a php script that monitors page access for sites that arent given access to server logs,
internally it is javascript
php is a flexible language,
's why the header is able to send anycontent-type information
<img src=servpic.php?=9999> is also valid
depending on circumstance

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.