title: How to make a PHP XML/RPC call to UPC database
body: <p>hay i am working on barcode reader project when i call upcdatabase from my php script it give me errors. i use the php example provided by <a href="http://www.upcdatabase.com" rel="nofollow">www.upcdatabase.com</a> </p>
  
  <p>the code is</p>
  
  <pre><code>&lt;?php error_reporting(E_ALL);
  ini_set('display_errors', true);
  
   require_once 'XML/RPC.php';
  
   $rpc_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // Set your rpc_key here
   $upc='0639382000393';
   // Setup the URL of the XML-RPC service
   $client = new XML_RPC_Client('/xmlrpc', 'http://www.upcdatabase.com');
   $params = array( new XML_RPC_Value( array(
    'rpc_key' => new XML_RPC_Value($rpc_key, 'string'),
    'upc' => new XML_RPC_Value($upc, 'string'),
    ), 'struct'));
   $msg = new XML_RPC_Message('lookup', $params);
   $resp = $client->send($msg);
   if (!$resp)
              {
    echo 'Communication error: ' . $client->errstr;
    exit;
   }
   if(!$resp->faultCode())
   {
    $val = $resp->value();
    $data = XML_RPC_decode($val);
    echo "&lt;pre>" . print_r($data, true) . "&lt;/pre>";
   }else{
    echo 'Fault Code: ' . $resp->faultCode() . "\n";
    echo 'Fault Reason: ' . $resp->faultString() . "\n";
   }
  ?>
  </code></pre>
  
  <p>when i check the $upc='0639382000393'; into upc data base <a href="http://www.upcdatabase.com/itemform.asp" rel="nofollow">view this</a> then it works fine but i run this script into the browser then it give the following error <pre>Array
  (
      [status] => fail
      [message] => Invalid UPC length
  )</pre></p>