Login   Register  
PHP Classes
elePHPant
Icontem

URL parameters

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      REST Server  >  All threads  >  URL parameters  >  (Un) Subscribe thread alerts  
Subject:URL parameters
Summary:URL Parameters
Messages:4
Author: John Smith
Date:2009-05-15 14:19:13
Update:2009-05-15 16:18:55
 

  1. URL parameters   Reply   Report abuse  
Picture of  John Smith
John Smith
2009-05-15 14:19:13
Hey

I was just wondering how to go about setting up a url for a resource and then passing it variables and the data as part of those variables

http://localhost/restserver/example/?q=get_temperature&sID=1 ... etc
e.g.

$rest->addMap("GET","/?q=/get_temperature&sID=/" . $_GET["sID"], "CompetitionDetails::get_temperature");

As it stands i can't get the sid variable
Is this possible?

Thanks

  2. Re: URL parameters   Reply   Report abuse  
Picture of Diogo Souza da Silva
Diogo Souza da Silva
2009-05-15 15:34:32 - In reply to message 1 from John Smith
Hello,

I guess in this case you can do like this:

When creating the RestServer, pass the "q" to it:

$rest = new RestServer($_GET['q']);

This way when you map it, you can just do the following:

$rest->addMap("GET","/?get_temperature","CompetitionDetails::get_temperature");

On CompetitionDetails::get_temperature, you can recover the sID using the following line:

$sID = $rest->getRequest()->getGET("sID");

I guess that's it.

  3. Re: URL parameters   Reply   Report abuse  
Picture of  John Smith
John Smith
2009-05-15 15:52:30 - In reply to message 2 from Diogo Souza da Silva
thanks, that worked perfect, i am using this package with a java client and it has worked great

  4. Re: URL parameters   Reply   Report abuse  
Picture of Diogo Souza da Silva
Diogo Souza da Silva
2009-05-15 16:18:55 - In reply to message 3 from John Smith
That's great! I just released a RestServer with a Java client too :)