The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Error adding redirects with PHP XML API

Discussion in 'General Discussion' started by Tiancris, Nov 29, 2012.

  1. Tiancris

    Tiancris Registered

    Joined:
    Nov 29, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    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!
     
    #1 Tiancris, Nov 29, 2012
    Last edited: Nov 29, 2012
  2. Tiancris

    Tiancris Registered

    Joined:
    Nov 29, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Oh, come on, my English is not so bad... I think ...
     
  3. Tiancris

    Tiancris Registered

    Joined:
    Nov 29, 2012
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    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
     
Loading...

Share This Page