Welcome to WebmasterWorld Guest from 54.167.5.15

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

External Javascript needed

     

hassanzobeen

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

5+ Year Member



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

e.g.

<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

<?php

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

penders

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

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



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.

hassanzobeen

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

5+ Year Member



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

Dijkgraaf

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

WebmasterWorld Senior Member 10+ Year Member



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

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

hassanzobeen

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

5+ Year Member



not working
please solveee

eelixduppy

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

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



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

penders

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

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



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?

hassanzobeen

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

5+ Year Member



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

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

Dijkgraaf

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

WebmasterWorld Senior Member 10+ Year Member



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.

hassanzobeen

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

5+ Year Member



COde:

<?php

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


URL:
check.php?info=https://google.com


Result:
(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>

hassanzobeen

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

5+ Year Member



plz helppp
 

Featured Threads

Hot Threads This Week

Hot Threads This Month