Description
You can list domain forwarders using the List Domain Forwarding API.
The API response will contain all the domain forwarders listed for the user.
Parameters
Sample Code
curl --insecure -u "root:password" "https://hostname:2005/index.php?act=redirect_list&api=json"<?php
$user = "username";
$pass = "password";
// API URL
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@hostname:2005/index.php?act=redirect_list&api=json';
// Set the curl parameters
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Get response from the server.
$resp = curl_exec($ch);
// The response will hold a string as per the API response method. In this case its PHP Serialize
$res = json_decode($resp, true);
// Print result
if(!empty($res['redirect_list'])){
echo "<pre>";
print_r($res['redirect_list']);
echo "</pre>";
}else{
print_r($res['error']);
}
?>Output
Array
(
[example.com/] => Array
(
[rid] => 1
[user] => username
[domain] => example.com
[path] => /
[type] => temporary
[address] => forwarded_domain
)
)