PHP Classes

Thanks for your hard work on this, it's really useful and has...

Recommend this page to a friend!

      REST Client  >  All threads  >  Thanks for your hard work on this,...  >  (Un) Subscribe thread alerts  
Subject:Thanks for your hard work on this,...
Summary:Package rating comment
Messages:1
Author:Ian Gibbons
Date:2010-05-25 11:39:46
 

Ian Gibbons rated this package as follows:

Utility: Good
Consistency: Good
Examples: Not sure

  1. Thanks for your hard work on this,...   Reply   Report abuse  
Picture of Ian Gibbons Ian Gibbons - 2010-05-25 11:39:46
Thanks for your hard work on this, it's really useful and has saved me a lot of time.

Part of my project was to consume the ebay product finding api. For some reason beyond my comprehension, I ran into a problem with this when I was calling the findItemsByProduct method [url]http://developer.ebay.com/DevZone/finding/CallRef/findItemsByProduct.html[/url]

The problem was the call failed if the url parameters started with ?&var=value... The only thing that worked was ?var=value...

With a slight adjustment to treatURL() I was able to get this work perfectly...

[code]
private function treatURL(){
if(is_array($this->params) && count($this->params) >= 1) { // Transform parameters in key/value pars in URL
if(!strpos($this->url,'?'))
$this->url .= '?' ;
$i = 0;
foreach($this->params as $k=>$v) {
if ($i) $this->url .= "&";
$this->url .= urlencode($k)."=".urlencode($v);
$i++;
}
}
return $this->url;
}
[/code]

so i just introduced the $i variable to make sure the '&' wasn't being prepended to the first variable in the url.