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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nautilus

    #1

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


    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_he re
    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!

  • kaeli

    #2
    Re: Trouble passing JS parameter to PHP program /or/ executing the PHP

    In article <-5OdnRVRkPNyMfHc RVn-pQ@comcast.com> ,
    reply_in_newsgr oup_thanks@exam ple.com enlightened us with...[color=blue]
    >
    > The PHP code itself works, if I go in through SSH and enter this:
    > php ./my.php url=anything_he re
    > 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?
    >[/color]

    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.



    Comment

    • Nautilus

      #3
      Re: Trouble passing JS parameter to PHP program /or/ executing the PHP

      On Wed, 13 Oct 2004 09:41:05 -0500, kaeli
      <tiny_one@NOSPA M.comcast.net> wrote:
      [color=blue]
      >In article <-5OdnRVRkPNyMfHc RVn-pQ@comcast.com> ,
      >reply_in_newsg roup_thanks@exa mple.com enlightened us with...[color=green]
      >>
      >> The PHP code itself works, if I go in through SSH and enter this:
      >> php ./my.php url=anything_he re
      >> 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?
      >>[/color]
      >
      >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.[/color]

      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!

      Comment

      Working...