buy
Domain Forwarding

Description

Use the Domain Forwarding API to Forward Domain to another domain

The API response The Redirection was added successfully.

Parameters

Sample Code

curl --insecure  "https://hostname:2005/index.php?api=json&act=domain_forwarding&save=1&dom_search=domain.com&path=home&type=temporary&address=https://domain2.com&apiuser=user_name&apikey=pass_api_key"
<?php
 
$url = 'https://hostname:2005/index.php?api=json&act=domain_forwarding&apiuser=user_name&apikey=pass_api_key'; 

$post = array('save' => 1, 
	      'dom_search' => 'domain.com',
              'path' => 'home',
	      'type' => 'temporary',
	      'address' => 'https://domain2.com'
);


// 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); 

if(!empty($post)){
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}

// Get response from the server. 
$resp = curl_exec($ch);

// The response will hold a string as per the API response method. 
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
    echo "<pre>";
    print_r($res['done']);
    echo "</pre>";
}else{
	print_r($res['error']);
}
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');

$user = 'user_name';
$pass = 'password';
$host = 'hostname';

$webuzo = new Webuzo_Admin_SDK($user, $pass, $host);

$domain = 'domain.com';
$type = 'temporary/permanent';
$address = 'https://domain2.com';
$path = 'home';

$res = $webuzo->domain_forwarding($domain, $address, $type, $path);

// Done/Error
if(!empty($res['error'])){
	print_r($res['error']);
}else{
	print_r($res);
}

?>

Output

The Redirection was added successfully

    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list