• Hey Guest, we're evolving the future of TeaSpeak.
    You're invited to join the discussion here!

Release Simple Server Hosting Script

Status
Not open for further replies.

BIOS

TeaSpeak Team
Staff member
TeaTeam
wäre praktisch wenn mir jemand zur hand gehen würde ich komme mit der api von cloudflare atm nicht zurecht der läd die domains nicht....
 

BIOS

TeaSpeak Team
Staff member
TeaTeam
sollen ja keine subdomain aufen server angelegt werden lediglich in der cloudflare dns verwaltung dazu müsste das script aber über die api die domains laden ;)

und es ist via cloudflare möglich den meinen allen ts hab ich auch die ne dns über cloudflare verpasst
 

Kevinos

Fanatic member
Premium User
I do not think it's possible to list the domains via the cloudflare API, each domain has a different zone, and the API needs a specific zone for it to work.
For example, if you take the zone of a domain A, you can only manage that zone of domain A.
 

Kalle801

Active member
Brauche ich den Create DNS record key ?

Okay, hab den Global Key gefunden aber mir wird keine Domain angezeigt.
 
Last edited:

xZarex

Member
I do not think it's possible to list the domains via the cloudflare API, each domain has a different zone, and the API needs a specific zone for it to work.
For example, if you take the zone of a domain A, you can only manage that zone of domain A.
You can list the zones:
JSON:
--  List Zones

curl -X GET "https://api.cloudflare.com/client/v4/zones?status=active&page=1&per_page=50&order=status&direction=desc&match=all" \
     -H "X-Auth-Email: EMAIL" \
     -H "X-Auth-Key: APIKEY" \
     -H "Content-Type: application/json"
    
php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.cloudflare.com/client/v4/zones?status=active&page=1&per_page=50&order=status&direction=desc&match=all",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json",
    "x-auth-email: EMAIL",
    "x-auth-key: APIKEY"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

   
example:
{
   "result":[
      {
         "id":"asd341afb42hj5k5s9sdfm40smf04jgjsdf02",// ZONE ID!
         "name":"xzarex.xyz", // DOMAIN!
         "status":"active",
         "paused":false,
         "type":"full",
         "development_mode":0,
         "name_servers":[
            "adam.ns.cloudflare.com",
            "naomi.ns.cloudflare.com"
         ],
         "original_name_servers":[
            "dns2.registrar-servers.com",
            "dns1.registrar-servers.com"
         ],
         "original_registrar":null,
         "original_dnshost":null,
         "modified_on":"2018-10-21T07:03:44.154390Z",
         "created_on":"2018-07-13T12:03:35.190506Z",
         "activated_on":"2018-07-13T12:13:48.502583Z",
         "meta":{
            "step":3,
            "wildcard_proxiable":false,
            "custom_certificate_quota":0,
            "page_rule_quota":3,
            "phishing_detected":false,
            "multiple_railguns_allowed":false
         },
         "owner":{
            "id":"OWNERID",
            "type":"user",
            "email":"EMAIL"
         },
         "account":{
            "id":"ACCOUNTID",
            "name":"EMAIL"
         },
         "permissions":[
            "#access:edit",
            "#access:read",
            "#analytics:read",
            "#app:edit",
            "#auditlogs:read",
            "#billing:edit",
            "#billing:read",
            "#cache_purge:edit",
            "#dns_records:edit",
            "#dns_records:read",
            "#lb:edit",
            "#lb:read",
            "#legal:edit",
            "#legal:read",
            "#logs:edit",
            "#logs:read",
            "#member:edit",
            "#member:read",
            "#organization:edit",
            "#organization:read",
            "#ssl:edit",
            "#ssl:read",
            "#stream:edit",
            "#stream:read",
            "#subscription:edit",
            "#subscription:read",
            "#waf:edit",
            "#waf:read",
            "#webhooks:edit",
            "#webhooks:read",
            "#worker:edit",
            "#worker:read",
            "#zone:edit",
            "#zone:read",
            "#zone_settings:edit",
            "#zone_settings:read"
         ],
         "plan":{
            "id":"0feeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
            "name":"Free Website",
            "price":0,
            "currency":"USD",
            "frequency":"",
            "is_subscribed":true,
            "can_subscribe":false,
            "legacy_id":"free",
            "legacy_discount":false,
            "externally_managed":false
         }
      }
   ],
   "result_info":{
      "page":1,
      "per_page":50,
      "total_pages":1,
      "count":1,
      "total_count":1
   },
   "success":true,
   "errors":[

   ],
   "messages":[

   ]
}


-- List DNS Records with specific name
curl -X GET "https://api.cloudflare.com/client/v4/zones/*ZONEID*/dns_records?name=SUB.DOMAIN.TDL&page=1&per_page=50&order=type&direction=desc&match=all" \
     -H "X-Auth-Email: EMAIL" \
     -H "X-Auth-Key: APIKEY" \
     -H "Content-Type: application/json"

php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.cloudflare.com/client/v4/zones/*ZONEID*/dns_records?name=SUB.DOMAIN.TDL&page=1&per_page=50&order=type&direction=desc&match=all",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json",
    "x-auth-email: EMAIL",
    "x-auth-key: APIKEY"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);
    
example:
{
   "result":[

   ],
   "result_info":{
      "page":1,
      "per_page":50,
      "total_pages":0,
      "count":0, // perfect -> no dns record with our name
      "total_count":0
   },
   "success":true,
   "errors":[

   ],
   "messages":[

   ]
}

-- Create A DNS Record

curl -X POST "https://api.cloudflare.com/client/v4/zones/*ZONEID*/dns_records" \
     -H "X-Auth-Email: EMAIL" \
     -H "X-Auth-Key: APIKEY" \
     -H "Content-Type: application/json" \
     --data '{"type":"A","name":"ts.xzarex.xyz","content":"127.0.0.1","ttl":1,"priority":10,"proxied":false}'

php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.cloudflare.com/client/v4/zones/*ZONEID*/dns_records",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_POST => 1,
  CURLOPT_POSTFIELDS => "{\"type\":\"A\",\"name\":\"ts.xzarex.xyz\",\"content\":\"127.0.0.1\",\"ttl\":1,\"priority\":10,\"proxied\":false}",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json",
    "x-auth-email: EMAIL",
    "x-auth-key: APIKEY"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

example:
{
   "result": {
      "id": "68c21a9970bf7ccc145751cb36ea0c02",
      "type": "A",
      "name": "ts.xzarex.xyz",
      "content": "127.0.0.1",
      "proxiable": false,
      "proxied": false,
      "ttl": 1,
      "locked": false,
      "zone_id": "499fb35cCCCCC8a6d91",
      "zone_name": "xzarex.xyz",
      "modified_on": "2019-05-14T16:06:01.699504Z",
      "created_on": "2019-05-14T16:06:01.699504Z",
      "meta": {
         "auto_added": false,
         "managed_by_apps": false,
         "managed_by_argo_tunnel": false
      }
   },
   "success": true,
   "errors": [],
   "messages": []
}

-- Create SRV DNS Record

curl -X POST "https://api.cloudflare.com/client/v4/zones/*ZONEID*/dns_records" \
     -H "X-Auth-Email: EMAIL" \
     -H "X-Auth-Key: APIKEY" \
     -H "Content-Type: application/json" \
     --data '{"type":"SRV", "data": {"service":"_ts3", "proto":"_udp", "name":"ts3.xzarex.xyz","target":"ts.xzarex.xyz","port": 9987,"ttl":1,"priority":10, "weight":1,"proxied":false}}'

php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.cloudflare.com/client/v4/zones/*ZONEID*/dns_records",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_POST => 1,
  CURLOPT_POSTFIELDS => "{\"type\":\"SRV\", \"data\": {\"service\":\"_ts3\", \"proto\":\"_udp\", \"name\":\"ts3.xzarex.xyz\",\"target\":\"ts.xzarex.xyz\",\"port\": 9987,\"ttl\":1,\"priority\":10, \"weight\":1,\"proxied\":false}}",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json",
    "x-auth-email: EMAIL",
    "x-auth-key: APIKEY"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

example:
{
   "result": {
      "id": "8aba0bb02ASDASDSD3e03c152",
      "type": "SRV",
      "name": "_ts3._udp.ts3.xzarex.xyz",
      "content": "1\t9987\tts.xzarex.xyz",
      "proxiable": false,
      "proxied": false,
      "ttl": 1,
      "priority": 10,
      "locked": false,
      "zone_id": "499fb35ASDASD48a6d91",
      "zone_name": "xzarex.xyz",
      "modified_on": "2019-05-14T16:08:34.586992Z",
      "created_on": "2019-05-14T16:08:34.586992Z",
      "meta": {
         "auto_added": false,
         "managed_by_apps": false,
         "managed_by_argo_tunnel": false
      },
      "data": {
         "service": "_ts3",
         "proto": "_udp",
         "name": "ts3",
         "weight": 1,
         "port": 9987,
         "target": "ts.xzarex.xyz",
         "priority": 10
      }
   },
   "success": true,
   "errors": [],
   "messages": []
}
 
Last edited:

cronox0000

New member
updatet final release and project done
Hello BIOS, I have a concern, I know that does not correspond to this thread but well, I downloaded your whmcs module, I install it according to your steps to follow but when creating a server appears offline, my cpanel account has all ports open tando tcp as udp, but a convert error comes out.

and in the client area the server does not appear online.

type error:
Module command error
convert
in admin area


Thank you in advance for your contributions to the community, you have helped us a lot
 

Attachments

Last edited:

BIOS

TeaSpeak Team
Staff member
TeaTeam
send me an pm

which os you use and hosting provider of your vps / root
 

BIOS

TeaSpeak Team
Staff member
TeaTeam
im ordner dns die ayarlar.inc.php bearbeiten und deine cloudflare daten eintragen
 
Status
Not open for further replies.