Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Trouble passing JS parameter to PHP program /or/ executing the PHP

Reply
Thread Tools

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

 
 
Nautilus
Guest
Posts: n/a
 
      10-13-2004

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!

 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      10-13-2004
In article <-5OdnRVRkPNyMfHcRVn->,
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

 
Reply With Quote
 
 
 
 
Nautilus
Guest
Posts: n/a
 
      10-13-2004
On Wed, 13 Oct 2004 09:41:05 -0500, kaeli
<> wrote:

>In article <-5OdnRVRkPNyMfHcRVn->,
> 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!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameter to function not expecting parameter Mister B C Programming 8 08-26-2010 08:01 AM
PHP Training Institute In Delhi, Live Projects on PHP. Short TermPHP Courses, PHP Scripts, PHP Training with Live Projects. Rajive Narain Java 0 09-18-2009 10:47 AM
passing arguments from a python program to other while executing itwith exec() or spawn() in LINUX gaurav kashyap Python 2 10-16-2008 08:16 AM
Executing a JAVA Program from a JAVA Program Shadow123 Java 0 08-11-2008 07:13 PM
Passing a parameter in PHP amerar@iwc.net Javascript 11 09-05-2007 10:15 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57