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

N

Nautilus

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!
 
K

kaeli

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.

--
 
N

Nautilus

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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top