connect to external php script??

Discussion in 'JavaScript' started by Javver, Oct 8, 2007.

  1. #1
    hello, im new to all of this

    i have php embeded in html and saved as index.php, in html part of it i want to
    connect to an external PHP script located in my friend's webspace i use the <script> tag

    both doesnt work.
    <script src="http://domain.com/filename.php"></script> and

    <script type="text/javascript" src="http://domain.com/filename.php"></script>


    i just want to simply output the result of that php script in the certain part of my site.

    my php scripts are working, but this part im having prob. with

    am i using the correct method?
     
    Javver, Oct 8, 2007 IP
  2. GMROCKS

    GMROCKS Active Member

    Messages:
    648
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #2
    your friend's page shoud be something like
    <script  type="text/javascript">
    document.write("HTML HERE");
    </script>
    HTML:
     
    GMROCKS, Oct 8, 2007 IP
  3. Javver

    Javver Active Member

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    sorry this doesnt work
     
    Javver, Oct 8, 2007 IP
  4. KatieK

    KatieK Active Member

    Messages:
    116
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #4
    A PHP script is processed on the sever, whereas JavaScripts are processed inside the broswer, so they're really not compatible.

    I think you're going to have to copy your friend's PHP file to your site, then include it via PHP. Your server will need to process that PHP.

    Alternately, I suppose you could use an iframe on your page, and have the source of the iframe be the PHP file.
     
    KatieK, Oct 8, 2007 IP
  5. madura99

    madura99 Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Mmm yeah I have done this.

    visit wwwDOTlankacarsaleDOTcom and view source

    if you want to use dynamically created javascript using php server side scripting
    you can use <script type="text/javascript" src="http://domain.com/filename.php"></script> without having any problems

    but make sure to avoid <script type="text/javascript"></script> tag in the php file

    if you can not modify your friend script as you want above, you have use your own script.
     
    madura99, Oct 8, 2007 IP
  6. KatieK

    KatieK Active Member

    Messages:
    116
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #6
    Madura,

    Oh, I see. You're using PHP to generate the JavaScript array. I should have thought of that.

    Javver, does this work out for you?
     
    KatieK, Oct 9, 2007 IP