Error adding redirects with PHP XML API

Tiancris

Registered
Nov 29, 2012
3
0
1
cPanel Access Level
Root Administrator
Hello! I have recently registered, I am a web developer from Argentina and working on an application using PHP XML API (it save my life, really!). In this app I can create and delete accounts, add parked domains, no problem with this... until now...

I have an account with domain1.com and parked domain2.com and I want to add a redirection from domain1 to domain2.
So, I write this code, based on this page: Mime Module Documentation

PHP:
$data = array(
        'src' => '', 
        'type' => 'permanent', 
        'domain' => 'http://www.domain1.com', // from this domain
        'url' => 'http://www.domain2.com', // to this domain
        'wildcard' => 1, 
        'rdwww' => 0
);
    
$result = $xmlapi->api1_query('username1', 'Mime', 'add_redirect', $data);
But, I'm getting this message: "You must fill in the full url to redirect to. Ignore any messages of success. This can only result in failure!".

Adding the same redirect with cpanel works successfully, I am missing something? Any idea?

Thanks you!
 
Last edited:

Tiancris

Registered
Nov 29, 2012
3
0
1
cPanel Access Level
Root Administrator
I did it! \(._.)/

The solution is not to use keys in the array, only the values.

PHP:
$data = array(
        '/', 
        'permanent', 
        'http://www.domain1.com',
        'http://www.domain2.com',
        '1', 
        '0'
);
Yeah! :D