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.

I want to add an A record to a domain [PHP]

Discussion in 'cPanel Developers' started by gamesguru, Mar 30, 2009.

  1. gamesguru

    gamesguru Member

    Joined:
    Nov 25, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Hello all,

    Please tell me how do i add A record to a domain and enter ip and hostname.

    I am willing to use php.

    Thanks
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    cPanel/WHM automatically creates all the dns records needed to host a website. Is there any particular reason you are looking to do this?
     
  3. gamesguru

    gamesguru Member

    Joined:
    Nov 25, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I just want to add A record of a hostname like sub.domain.com => 85.203.165.XXX

    Something like this.

    I think add dns command in xml api0 will work out but it creates a new dns zone i want to add A record in existing dns zone.

    Thanks
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Is this subdomain being hosted by that cPanel/WHM server or another server?
     
  5. yong1986

    yong1986 Registered

    Joined:
    May 10, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I'm trying to create a script in PHP that it add a desired subdomain name (A record or web forward) into the DNS, hosted on the same server with unlimited number of subdomain allowed by the host.
    What are the php commands to do it? I have access to WHM of the host.
    Thanks.
     
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Please elaborate, are you looking to create a subdomain, a subdomain that is redirected somewhere else, a parked domain (called domain or web forwarders in other environments) or a DNS A record?

    When you create subdomains in a cPanel/WHM environment, any required DNS records are automatically generated.
     
  7. yong1986

    yong1986 Registered

    Joined:
    May 10, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I'm trying to create an A record, which point to an IP address, and the target server will automatically get to the directory of the server, corresponding to the subdomain used.
    In short, I'm giving a free subdomain service to the user, with the script running in PHP.
    Thanks.
     
  8. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    To clarify, the target server is a remote server?
     
  9. yong1986

    yong1986 Registered

    Joined:
    May 10, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Yes, it is a server with different IP, which the adding of A record intended to point to.
     
  10. yong1986

    yong1986 Registered

    Joined:
    May 10, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    So is there a way to put the command in PHP to add an A record to the DNS list?
    Thanks.
     
  11. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Not yet, but we'll be implementing that in 11.25.
     
  12. miahac

    miahac Member

    Joined:
    Aug 12, 2008
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    You have got to be kidding me. If Cpanel a cpanel hoster is hosting your DNS you cannot add custom DNS records? What if you have a real business and need to add dns for other reasons than your web hosting and e-mail. I have domains with 20-30 a records.
     
  13. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Miahac,
    david is correct, this was previously unavailable, however it will be included in 11.25 which will go to release soon. This can be done via the API2 calls in the DNS module OR it can be done via the XML-API's addzonerecord call.
     
  14. Daledo

    Daledo Registered

    Joined:
    May 5, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Please elaborate...

    Could you please give me an example of the API2 calls or the XML-API addzonerecord call? Or just a link to some good info on it? I am trying to set up a new client on our server, and he wants to keep his current mail provider. Their instructions say to create an A record to their ip where the mx records are, but I cannot find a way to add an A record either. I am currently updating my WHM/Cpanel as it was at cPanel 11.24.5-R38506 - WHM 11.24.2 - X 3.9 in hopes that it will update to 11.25... Any help is greatly appreciated.
     
  15. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi Daledo,

    I don't have an 11.24.5 install handy to confirm that it's identical, but in 11.25.0 you can select MX Entry in the Mail section of the cPanel interface. Here, you'd select Remote Mail Exchanger and click Change. Then add the new record (that points to the previous mail provider). However, this should be a Full Qualified Domain Name, and not an IP.

    I fail to see how an A record will push inbound mail for the domain to the previous mail provider. You'll need to create an MX record.

    If you still need to use XML-API/API2, I'd be glad to help. But if you're just adding this record for a single client, the standard cPanel UI should do the trick.

    Regards,
    -David
     
  16. Daledo

    Daledo Registered

    Joined:
    May 5, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hey David,
    I upgraded today to 11.25.0 and I can tell you, I'm glad I did. I've already noticed more options that weren't there previously. The new UI on this looks like it makes it much easier to manage than 11.24.x.
    I have my doubts as well, but they were very persistent that I delete my MX records for the domain and just create an A record of mail.domainname.com and point it to the ip they specified... Thank you for responding, and if I do end up needing to go ahead with the XML-API/API2, I thank you in advance for any assistance you may provide.
     
Loading...

Share This Page