douli1872 2010-11-15 07:37
浏览 46

域API循环

How can I perform the following with this API?

Form is setup in PHP for registered user to enter domain name On submit..

Check if domain is available >

  • If NO > output to XML > run the loop again in 5 minutes
  • If YES > output to XML > go ahead and purchase (register) the domain > end loop

Thank you!

Sample API code

<?php /**  * Set the API URL  */ $sApiUrl = "https://www.apiurl.com/";


/**  * Set POST Parameters  */ $aParams = Array(
            'uid'     => "--USERNAME--",    // Username
            'pw'      => "--APIKEY--",      // API Key
            'command' => "querydomain",     // Command to Rum
            'sld'     => "sampledomain",    // Main part of the Domain
            'tld'     => "com");         // Domain Extension


/**  * Run the cURL command  */
$oCurl = curl_init(); curl_setopt($oCurl, CURLOPT_URL, $sApiUrl);
curl_setopt($oCurl, CURLOPT_POST, 1);
curl_setopt($oCurl, CURLOPT_POSTFIELDS, $aParams);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false);
$sResponse = curl_exec($oCurl); curl_close($oCurl);


/**  * Turn results into Simple XML Object  */
$oOutput = new SimpleXmlElement($sResponse);


/**  * Debugging output, so we can see what we just got  */
print_r($oOutput);

?>

API Commands

check Checks whether a domain name is available for registration.
purchase Registers a new domain name.
transfer Requests a domain transfer to registrar.
extend Extends (renews) domain registration.
changepassword Changes the domain password.
sendpassword Send domain password to domain owner.
contacts Changes domains contacts.
querydomain Returns detailed information about the domain.
sendepp Sends gTLD epp key to domain owner.
refillaccount Refills your reseller account with funds.
changedomainns Changes domains name servers.
sendtransferemail Sends transfer authorisation request to domain owner.
addchildns Add child name server to domain.
updatechildns Update details for child name server.
removechildns Remove child name server from domain.
pushdomain Push domain to another registrar reseller.
getdnsrecords Get domain name server records for a domain.
enablednsdomain Create DNS domain service for domain.
adddnsrecord Add new DNS record to domain.
updatednsrecord Update DNS record for a domain.
removednsrecord Remove DNS record from a domain.
updatednssoa Update DNS SOA record for a domain.
disablednsdomain Destroy DNS domain service for a domain.
getmailrecords Get mail forwarding records for a domain.
addmailforwarder Add a mail forwarder to a domain.
removemailforwarder Remove a mail forwarder from a domain.
updatemailforwarder Update the details of a Mail Forwarder for a domain.
geturlrecords Get URL Forwarding records for a domain.
addurlforwarder Add a URL Forwarding record to a domain.
updateurlforwarder Update a URL Forwarding record for a domain.
removeurlforwarder Remove a URL Forwarding record for a domain.
getreglock Get registry lock details for a domain.
setreglock Set a registry lock for a domain.
updatecontact Update an address book entry.
getapiinfo Get information about the Domain System API.
transferout Push a domain name to another registrar, given their tag.

Outputted XML from example above

SimpleXMLElement Object

( [results] => SimpleXMLElement Object ( )

[errors] => SimpleXMLElement Object
    (
        [error] => SimpleXMLElement Object
            (
                [domain] => SimpleXMLElement Object
                    (
                        [name] => google.com
                        [status] => SimpleXMLElement Object
                            (
                                [code] => 211
                                [text] => Unavailable
                                [description] => The domain name you queried has been registered through another registrar.
                            )

                    )

            )

    )

[errorcount] => 1
[exectime] => 0.399 second(s)
[enviroment] => live
[version] => 2.3.9 beta

)

  • 写回答

1条回答 默认 最新

  • douji6940 2010-11-16 04:42
    关注

    I can see what it is you are trying to do. However which part in particular are you having issues with? It looks as though you have the API already. Is it not functioning correctly?

    Do you need help in writing the PHP to do your 'Yes'/'No' step above?

    And why are you "checking again in 5 minutes"?

    评论

报告相同问题?

悬赏问题

  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图