Trouble passing JS parameter to PHP program /or/ executing the PHP

Discussion in 'Javascript' started by Nautilus, Oct 13, 2004.

  1. Nautilus

    Nautilus Guest

    Taken from a couple very similar samples on the net, I'm having
    trouble passing a parameter to a PHP file.

    Here's all the JS code ... it creates an image object and modifies
    it's src to make a 'call' to the PHP file:
    var myobj = new Image();
    myobj.src = 'http://www.mypage.com/my.php?url=' + 'anything_here';

    The process seems to recognize that the file URL ends at the "?", and
    system logs show that the GET of the PHP file was successful.
    However, it doesn't seem to execute the PHP (internal debug logging
    does not occur).

    The PHP code itself works, if I go in through SSH and enter this:
    php ./my.php url=anything_here
    then the PHP uses $_GET['url'] and parses/logs the param just fine.

    If I replace the "?" with a space (like the SSH command line) then the
    server seems to think the whole line (or at least up to the '=' sign)
    is the file's URL and I get a 404 error (file not found).

    Any suggestions / debugging ideas?

    THANKS!
    Nautilus, Oct 13, 2004
    #1
    1. Advertising

  2. Nautilus

    kaeli Guest

    In article <>,
    enlightened us with...
    >
    > The PHP code itself works, if I go in through SSH and enter this:
    > php ./my.php url=anything_here
    > then the PHP uses $_GET['url'] and parses/logs the param just fine.
    >
    > If I replace the "?" with a space (like the SSH command line) then the
    > server seems to think the whole line (or at least up to the '=' sign)
    > is the file's URL and I get a 404 error (file not found).
    >
    > Any suggestions / debugging ideas?
    >


    What happens when you access it through a normal browser link (not SSH)?
    What happens during SSH tells you nothing about what will happen when a
    browser requests the file, which is what the javascript is essentially doing.

    The server settings may not be set up properly. SSH wouldn't catch that.

    --
    --
    ~kaeli~
    You feel stuck with your debt if you can't budge it.
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
    kaeli, Oct 13, 2004
    #2
    1. Advertising

  3. Nautilus

    Nautilus Guest

    On Wed, 13 Oct 2004 09:41:05 -0500, kaeli
    <> wrote:

    >In article <>,
    > enlightened us with...
    >>
    >> The PHP code itself works, if I go in through SSH and enter this:
    >> php ./my.php url=anything_here
    >> then the PHP uses $_GET['url'] and parses/logs the param just fine.
    >>
    >> If I replace the "?" with a space (like the SSH command line) then the
    >> server seems to think the whole line (or at least up to the '=' sign)
    >> is the file's URL and I get a 404 error (file not found).
    >>
    >> Any suggestions / debugging ideas?
    >>

    >
    >What happens when you access it through a normal browser link (not SSH)?
    >What happens during SSH tells you nothing about what will happen when a
    >browser requests the file, which is what the javascript is essentially doing.


    Doh! I should have thought of making a normal link. Found out the
    web user doesn't have write permissions in that directory... made
    another dir and I'm all set. Thanks!
    Nautilus, Oct 13, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shadow123
    Replies:
    0
    Views:
    285
    Shadow123
    Aug 11, 2008
  2. gaurav kashyap
    Replies:
    2
    Views:
    272
    gaurav kashyap
    Oct 16, 2008
  3. Rajive Narain
    Replies:
    0
    Views:
    1,558
    Rajive Narain
    Sep 18, 2009
  4. Mister B
    Replies:
    8
    Views:
    528
    Nick Keighley
    Aug 26, 2010
  5. Passing a parameter in PHP

    , Sep 4, 2007, in forum: Javascript
    Replies:
    11
    Views:
    151
    The Natural Philosopher
    Sep 5, 2007
Loading...

Share This Page