-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
178 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Namecheap\Command\Domains\Renew | ||
{ | ||
class Exception extends \Exception {} | ||
} | ||
|
||
namespace Namecheap\Command\Domains | ||
{ | ||
class Renew extends \Namecheap\Command\ACommand | ||
{ | ||
public $domain = array(); | ||
|
||
public function command() | ||
{ | ||
return 'namecheap.domains.renew'; | ||
} | ||
|
||
public function params() | ||
{ | ||
return array( | ||
'DomainName' => null, | ||
'Years' => 1, | ||
); | ||
} | ||
|
||
/** | ||
* Process domains array | ||
*/ | ||
protected function _postDispatch() | ||
{ | ||
foreach ($this->_response->DomainRenewResult->attributes() as $key => $value) | ||
{ | ||
$this->domain[$key] = (string) $value; | ||
} | ||
} | ||
|
||
/** | ||
* Get/set method for domain list, limited to 70 characters | ||
* @param string $value | ||
* @return mixed | ||
*/ | ||
public function domainName($value = null) | ||
{ | ||
if (null !== $value) | ||
{ | ||
$this->setParam('DomainName', (string) substr($value, 0, 70)); | ||
return $this; | ||
} | ||
return $this->getParam('DomainName'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Namecheap\Command\Users\GetPricing | ||
{ | ||
class Exception extends \Exception {} | ||
} | ||
|
||
namespace Namecheap\Command\Users | ||
{ | ||
class GetPricing extends \Namecheap\Command\ACommand | ||
{ | ||
public $data = array(); | ||
|
||
public function command() | ||
{ | ||
return 'namecheap.users.getPricing'; | ||
} | ||
|
||
public function params() | ||
{ | ||
return array( | ||
'ProductType' => 'DOMAIN', | ||
'ProductCategory' => null, | ||
); | ||
} | ||
|
||
/** | ||
* Process domains array | ||
*/ | ||
protected function _postDispatch() | ||
{ | ||
foreach ($this->_response->UserGetPricingResult->attributes() as $key => $value) | ||
{ | ||
$this->data[$key] = (string) $value; | ||
} | ||
} | ||
|
||
/** | ||
* Get/set method for domain list, limited to 1024 characters | ||
* @param string|array $value | ||
* @return mixed | ||
*/ | ||
public function domainName($value = null) | ||
{ | ||
if (null !== $value) | ||
{ | ||
$this->setParam('DomainName', (string) substr($value, 0, 70)); | ||
return $this; | ||
} | ||
$this->getParam('DomainName'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?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.renew'); | ||
$command->setParams(array( | ||
'DomainName' => 'example1.com', | ||
'Years' => 1 | ||
))->dispatch(); | ||
} catch (\Exception $e) { | ||
die($e->getMessage()); | ||
} | ||
|
||
if ($command->status() == 'error') { die($command->errorMessage); } | ||
d($command); | ||
|
||
function d($value = array()) | ||
{ | ||
echo '<pre>' . "\n"; | ||
print_r($value); | ||
die('</pre>' . "\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?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"); | ||
} |