简体   繁体   中英

Zend Routing — Grabbing Variables from URL with Ampersands and not Slashes - Tapjoy

I'm currently creating attempting to integrate with the Tapjoy API with their callback URL request which comes in this form:

<callback_url>?snuid=<user_id>&currency=&mac_address=<mac_address>&display_multiplier=<display_multiplier>

However, using ZF1 -- the Zend_Controller_Router_Route seems to be dependent on the variable separation being delimited by slashes and not ampersands.

Here is my current Route code

>     $router->addRoute( 'api-tapjoy', new Zend_Controller_Router_Route('api/tapjoy?snuid=:snuid&mac_address=:&mac_address&display_multiplier....etc.etc,
array('controller'=>'api', 'action' =>'tapjoy')));

Whenever I remove the ampersands and initial question mark and replace them with slashes it works. How can I properly receive the HTTP Request whilst using ampersands?

Looks like I figured it out. It has nothing to do with ampersands and slashes, etc. but rather that my Route wasn't created properly.

I was thrown off by this documentation on ZF1's website about routers:

The first parameter in the Zend_Controller_Router_Route constructor is a route definition that will be matched to a URL. Route definitions consist of static and dynamic parts separated by the slash ('/') character. Static parts are just simple text: author. Dynamic parts, called variables, are marked by prepending a colon to the variable name: :username.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM