0
votes

I am trying to write a handler in google appengine using APP.YAML. I am trying to accomplish the following:

/API/Module/Action/ -> api.php?module=**Module**&action=**Action**

I have tried the following:

- url: /api/(.*)/(.*)
  script: api2.php?module=\2&action=\1  # specify a script

Does anyone have any ideas?

Thanks,

3

3 Answers

0
votes

I think it should be:

url: /api/(.*)/(.*)
0
votes

What is the result you are seeing? You have reversed "module" and "action", and also have to handle that trailing slash. Try:

- url: /api/(.*)/(.*)/
  script: api2.php?module=\1&action=\2  # specify a script
0
votes

Try this:

- url: /api/(.*)/(.*)/
  script: api2.php

Then, inside your api2.php handler:

$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$segments = explode('/', $path);
// $segments[0] == "api"
module = $segments[1]
action = $segments[2]