#1
  1. No Profile Picture
    rubbish in javascript
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    London
    Posts
    704
    Rep Power
    14

    Question reading in a distant javascript file


    hello

    trying to pull in a script here....

    http://map.geoup.com/geoup?template=welcome

    which gives geographical location according to ip however using file(); or readfile(); just gives an empty...

    document.write('');

    the passed variable seems to be disregarded??? anyone know how i might be able to do this???

    a+
    gar
  2. #2
  3. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    16
    Post the code you're using.
    Alex
    (http://www.alex-greg.com)
  4. #3
  5. No Profile Picture
    rubbish in javascript
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    London
    Posts
    704
    Rep Power
    14
    well i have'nt got code as such but so far i've tried...

    $location = readfile('http://map.geoup.com/geoup?template=welcome');
    echo $location;

    and...

    $location = file('http://map.geoup.com/geoup?template=welcome');
    print_r($location);

    and...

    $location = implode("", file('http://map.geoup.com/geoup?template=welcome'));
    echo $location;


    the code on their site is...
    <script language="Javascript" src="http://map.geoup.com/geoup?template=CityName"></script>

    then to get the city for example use....
    <%city%>

    i think all i need is for a variable in javascript be put into a variable in php! but not sure how to do this i have done the opposite before but not sure how to escape to javascript within the php to print the city variable, any ideas???

    a+
    gar
  6. #4
  7. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    16
    $location = readfile('http://map.geoup.com/geoup?template=welcome');
    echo $location;
    From http://www.php.net/manual/en/function.readfile.php:

    Versions prior to PHP 4.0.5 do not handle HTTP redirects. Because of this, directories must include trailing slashes.

    What version of PHP are you running? The command:


    PHP Code:
    <?

    phpinfo
    ();

    ?>
    will tell you if you don't know.
    Alex
    (http://www.alex-greg.com)
  8. #5
  9. No Profile Picture
    rubbish in javascript
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2001
    Location
    London
    Posts
    704
    Rep Power
    14
    >What version of PHP are you running?

    PHP Version 4.1.2

    as i said in my last post i think all i need to know is how to put a variable in javascript into php, so any ideas how i escape to javascript in php??

    a+
    gar

IMN logo majestic logo threadwatch logo seochat tools logo