/**
  * Execute a call to the Namecheap API
  * @return bool success or failure
  */
 public function dispatch()
 {
     $this->_beforeDispatch();
     // Verify config options
     $this->_config->check();
     $this->_prepareParameters();
     // Set the API url
     $this->_url = $this->_config->url . '?' . $this->getEncodedParams();
     // Perform any pre-connect code if the extending command class has defined it
     $this->_preConnect();
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_URL, $this->_config->url);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $this->getEncodedParams());
     $this->_result = curl_exec($ch);
     curl_close($ch);
     // Perform any post-connect code if the extending command class has defined it
     $this->_postConnect();
     if (false === $this->_result) {
         $this->errorMessage = 'Communication error with Namecheap.';
         throw new Exception((string) $this->_xml->Errors->Error);
         return false;
     }
     // Parse xml result
     $this->_xml = new \SimpleXMLElement($this->_result);
     // Save status
     $this->_status = strtolower($this->_xml['Status']);
     if ($this->_status == 'error') {
         $this->errorMessage = (string) $this->_xml->Errors->Error;
         throw new Exception((string) $this->_xml->Errors->Error);
         return false;
     } else {
         if ($this->_status == 'ok') {
             $this->_response = $this->_xml->CommandResponse;
         }
     }
     $this->_postDispatch();
     return true;
 }
<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_startup_errors', true);
ini_set('display_errors', true);
include_once '../Api.php';
try {
    $config = new \Namecheap\Config();
    $config->apiUser('api-username')->apiKey('api-key')->clientIp('your-ip')->sandbox(true);
    $command = Namecheap\Api::factory($config, 'domains.dns.getList');
    $command->domainName('example1.com')->dispatch();
} catch (\Exception $e) {
    die($e->getMessage());
}
d($command);
function d($value = array())
{
    echo '<pre>' . "\n";
    print_r($value);
    die('</pre>' . "\n");
}
<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_startup_errors', true);
ini_set('display_errors', true);
include_once '../Api.php';
try {
    $config = new \Namecheap\Config();
    $config->apiUser('api-username')->apiKey('api-key')->clientIp('your-ip')->sandbox(true);
    $command = Namecheap\Api::factory($config, 'users.getPricing');
    $command->setParams(array('ProductType' => 'DOMAIN', 'ProductCategory' => 'REGISTER'))->dispatch();
} catch (\Exception $e) {
    die($e->getMessage());
}
d($command);
function d($value = array())
{
    echo '<pre>' . "\n";
    print_r($value);
    die('</pre>' . "\n");
}