homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

External Javascript needed

 7:25 pm on Jan 18, 2012 (gmt 0)

Hello everyone
hope you will be fine today

I am trying to make a page rank checking script
which displays a pagerank
and users can embed my javascript file which will be linked to my site
but I have tried so many time and get errors again and again.
I need an external java script which displays a page rank image from my site into their sites by using this code


<script type="text/javascript" src="http://localhost/pg.php?info=http://www.domainname.com"></script>

when users put this code into their sites this will display pagerank image which will linked to my website
I am facing problems in this please resolve my issue

my php page coding is as follow


include "pagerank.php";
$url = $_GET['info'];
$image = "urdu/pr".getPagerank($url).".gif";



 7:59 pm on Jan 18, 2012 (gmt 0)

when users put this code into their sites this will display pagerank image

What makes you think this will display an image?

You are referencing your PHP script in the src of a script element, so the source page is expecting JavaScript to be returned, not an image. Are you intending JavaScript to create an IMG element on the page? If you want an image to be displayed then may be you need to use an IMG element? But your PHP script doesn't appear to return anything? You also need to urlencode() the parameter value you are passing to your script.


 9:44 pm on Jan 18, 2012 (gmt 0)

Yes it will display an image
all the 11 images of page ranks e.g. 0 ,1, 2, 3, 4, 5, 6, 7, 8, 9, 10
are stored in the directory

getPagerank($url) variable will get that number and shows the related image
e.g. if the page rank is 2
then this will display make a image url i.e. [localhost...]

and this image will display on their sites link with my website

but i dont know how to make an javascript embed code for displaying and linking my image


 3:30 am on Jan 19, 2012 (gmt 0)

function writeimage(URLtoImage)
document.write("<img src='"+URLtoImage+"' />");

get your PHP to write out the call to the function with the URL.


 6:17 pm on Jan 19, 2012 (gmt 0)

not working
please solveee


 6:23 pm on Jan 19, 2012 (gmt 0)

What's not working? What does your PHP script look like?


 7:17 pm on Jan 19, 2012 (gmt 0)

Are you returning the appropriate Content-Type header? If you are returning JavaScript, then this needs to be:
header('Content-Type: text/javaScript');

But as eelixduppy states... what's not working?


 7:33 pm on Jan 19, 2012 (gmt 0)

I also tried header('Content-Type: text/javaScript');
but nothing happens

can any one provide me the complete coding for this page plz


 8:31 pm on Jan 19, 2012 (gmt 0)

Sorry, but that generally won't happen, please post the relevant snippet of code in a post, and tell us what the results are, then someone can help you diagnose the issue.


 9:14 pm on Jan 19, 2012 (gmt 0)



include "pagerank.php";
$url = $_GET['info'];
$image = "urdu/pr".getPagerank($url).".gif";


(it will display an page rank image which are already stored in folder

html source code : <img src="urdu/pr9.gif">

but I need a javascript embed code for that so when ever users use this code on their website in the result that code will generate image of a page rank from my site

I need an embed code like this

<script type="text/javascript" src="http://mywebsite.com/check.php?info=websitename.com"></script>


 8:29 am on Jan 21, 2012 (gmt 0)

plz helppp

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved