Example Code (PHP)

اعضا > مرکز آموزش > API نمایندگی دامین > Example Code (PHP)

<?php
$data = array(
    "action"        => "RegisterDomain",
    "sld"       => "domainexample",
    "tld"       => "com",
    "regperiod"     => 1,
    "nameserver1"       => "ns1.domainexample.com",
    "nameserver2"       => "ns2.domainexample.com",
    "nameserver3"       => "ns3.domainexample.com",
    "nameserver4"       => "ns4.domainexample.com",
    "nameserver5"       => "ns5.domainexample.com",
    "dnsmanagement" => 1,
    "emailforwarding"   => 1,
    "idprotection"  => 1,
    "adminfirstname"    => "John",
    "adminlastname" => "Doe",
    "admincompanyname"  => "Company Name",
    "adminaddress1" => "Address 1",
    "adminaddress2" => "Address 2",
    "admincity"     => "City",
    "adminstate"    => "ST",
    "admincountry"  => "IT",
    "adminpostcode" => "12345",
    "adminphonenumber"  => "4455677888990",
    "adminemail"    => "admin@domainexample.com",
    "additionalfields"  => array()
);
$ch = curl\_init();
curl\_setopt($ch, CURLOPT\_URL, "https://ehost.host/billing/domainsResellerAPI/api.php");
curl\_setopt($ch, CURLOPT\_TIMEOUT, 30);
curl\_setopt($ch, CURLOPT\_FRESH\_CONNECT, 1);
curl\_setopt($ch, CURLOPT\_SSL\_VERIFYPEER, false);
curl\_setopt($ch, CURLOPT\_SSL\_VERIFYHOST, false);
curl\_setopt($ch, CURLOPT\_POSTFIELDS, http\_build\_query($data));
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);
curl\_setopt($ch, CURLOPT\_HEADER, true);
curl\_setopt($ch, CURLINFO\_HEADER\_OUT, 1);
$result = curl\_exec($ch);
$res    = json\_decode($result, true);
print\_r($res);
curl\_close($ch);
?>
آیا این پاسخ به شما کمک کرد؟
180 کاربر این را مفید یافتند 345 نظرات

در همین زمینه