buy
Delete Domain Forwarder

Description

This API allows you to delete an existing domain forwarder configured on the server.

You need to provide the domain, path, redirect type, and destination address to remove the specific redirect entry.

Parameters

Sample Code

curl --insecure -u "root:password" "https://hostname:2005/index.php?api=json&act=redirect_list&delete=1&domain=example.com&path=/&type=temporary&address=https://example2.com"
<?php

$user = 'your_user';
$pass = 'your_password';
$ip   = 'your_ip';

$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$ip.':2005/index.php?api=json&act=redirect_list';

// Redirect details
$post = array(
    'delete'  => '1',
    'domain'  => 'example.com',
    'path'    => '/',
    'type'    => 'temporary',
    'address' => 'https://example2.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);

// Decode JSON response
$res = json_decode($resp, true);

// Done ?
if(!empty($res['done'])){
	print_r($res['done']);

// Error
}else{
	print_r($res['error']);
}

?>

Output

"done": {
    "msg": "Redirection Deleted"
  }
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list