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.

Use php to add remote mysql hosts

Discussion in 'General Discussion' started by gravitygr, Oct 22, 2008.

  1. gravitygr

    gravitygr Registered

    Joined:
    Feb 27, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hi. I searched for this but found nothing unfortunately.
    I wonder if there is a way to use a php script (or built my own using some existing API) to add an IP in the Remote Database Access Hosts.
    I have to connect with a special software from different ip's on my database and wish not to add %.

    Thanx,
    Achilles
     
  2. DaveUsedToWorkHere

    DaveUsedToWorkHere Well-Known Member

    Joined:
    Dec 28, 2001
    Messages:
    689
    Likes Received:
    1
    Trophy Points:
    18
    You can do this in conjunction with the XML API. You'll need to use CURL to call this function:

    https://$domain:2083/xml-api/cpanel?xmlin=<cpanelaction><module>Mysql</module><func>addhost</func><args>$host</args></cpanelaction>

    You'll need to pass the cPanel account username and password in the headers of the request to authenticate.

    More XML API docs here: http://www.cpanel.net/plugins/xmlapi
     
Loading...

Share This Page