There is an great class in Google Code written in PHP that works as a wrapper to the UPS API, I started using it about a year ago and never had issues with it since I was using it with Flash/AMFPHP/PHP, but now that I am working with a new shopping cart where I need this functionality but the front end is PHP only, I noticed that I was starting to get the following error:

PHP:
  1. Parse error: syntax error, unexpected $end in path.../UPSRate.php(131) : eval()'d code on line 1[php]
  2. After investigating the issue further I was able to fix the issue by only using eval on those elements where 'value' wasn't undefined.
  3.  
  4. [php]if (isset($xml_elem['value'])) {
  5.          $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
  6.          eval($php_stmt);
  7. }

Notice that these parse errors do not break the application and that is why they weren't raising a flag in Flash but working on PHP alone we have to squash all these kind of warnings.