Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-11

CGI JSON RPC

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dimitrios Chr. Ioannidis

Hi all,

i surely need some help regarding the use of cgi with json rpc. I looked at the demo1 example and tested it with testcgi app from the command line. All was fine. Then i tried to run the demo1 cgi app from apache with a php json rpc client. It seems that i can't find the right uri to put into the php call. All calls goes to the default action named 'manual'.

I renamed the handler name from echo to myecho to resolve a conflict with the php's function echo. The following code for calling the cgi working fine :

<?php

include('JsonRpcClient.php');
$api = new JsonRpcClient('http://localhost/cgi-bin/demo.exe');
print $api->myecho("Hello from JSON RPC");

?>

Now, how do i call the dispatcher handler ? I tried to change the uri like this

$api = new JsonRpcClient('http://localhost/cgi-bin/demo.exe/dispatch');
$api = new
JsonRpcClient('http://localhost/cgi-bin/demo.exe?action=dispatch');

Nothing worked ...

Can someone give me a hint ?

PS: I attached the JsonRpcClient.php ...

regards,

Dimitrios Chr. Ioannidis

Reply by email

Unknown author
to Dimitrios Chr. Ioannidis
Dimitrios Chr. Ioannidis wrote 19 lines
Hi all, i surely need some help regarding the use of cgi with json rpc. I looked at the demo1 example and tested it with testcgi app from the command line. All was fine. Then i tried to run the demo1 cgi app from apache with a php json rpc client. It seems that i can't find the right uri to put into the php call. All calls goes to the default action named 'manual'. I renamed the handler name from echo to myecho to resolve a conflict with the php's function echo. The following code for calling the cgi working fine : <?php include('JsonRpcClient.php'); $api = new JsonRpcClient('http://localhost/cgi-bin/demo.exe'); print $api->myecho("Hello from JSON RPC"); ?>

First of all, I doubt that the extension .exe is registered as a CGI app ?

What happens if you type this URL in the browser ?

I would suspect that you must rename the exe to a .cgi extension, but that depends on your webserver setup.

Now, how do i call the dispatcher handler ? I tried to change the uri like this

You should append the module. I would think the URL is:

http://localhost/cgi-bin/demo.cgi/echo/dispatch

Michael.

Reply by email