API Documentation RunningExamples domain.get domain orders PHP

Aus EUserv Wiki

Wechseln zu: Navigation, Suche

back to API Documentation



//includes the class library
$xmlrpc_internalencoding = 'UTF-8';


//defines the function
function domain_get_domain_orders($host,$port,$username,$password,$api_path)

  //creates the serverurl
  $serverurl = 'https://'.$host.':'.$port.'/'.$api_path;

  //----------creates the message which will be send to the server----------

  //creates the request for the XML-RPC Server
  $request = new xmlrpcmsg('domain.get_domain_orders');
  //adds parameters to the request
    //creates a value of type struct which contains an array with the username and password
    new xmlrpcval

        //creates a value of type string which contains the "$username"
        'login' => new xmlrpcval($username, 'string'),
        //creates a value of type string which contains the "$password"
        'password' => new xmlrpcval($password, 'string'),

  //----------creates the XML-RPC client which represent a client of an XML-RPC server----------

  //creates the client
  $client = new xmlrpc_client($serverurl);
  //disable SSL Keycheck
  //----------sends the request to the server and gets the response----------

  //sends the request via https and writes it into $response. timeout is set to 0
  $response = $client->send($request,0,'https');
  //generates a storable representation of $response and writes it into $result_xml
  //echo $response->serialize();
  //checks the response. if the method "faultCode" returns zero, the response was succesfull
  if (0==$response->faultCode()) 
    //returns the value sent by the server
    $value = $response->value();
    //returns the actual PHP-language value of "value"
    $result_obj = $value->scalarval();
    //destroys "value"
    //returns the faultCode and the faultString
    return $error = array ( 'faultCode' => $response->faultCode(), 'faultString' => $response->faultString());
  //destroys "client"
  //destroys "response"
  //----------reads the result_obj----------
  //if result_obj is set then it returns the actual PHP-language value of "result_obj"
  if (isset($result_obj['status']))
    $value['status'] = $result_obj['status']->scalarval();

  if (isset($result_obj['domain_orders']))
    //reads the keys and values and list returns an array. if no keys and values are read out list returns no array and the while-loop stops execution
    while (list($keyname, $data) = $result_obj['domain_orders']->structEach())
      $data = $data->scalarval();
      $domain_orders[$keyname]['domain_id'] = $data['domain_id']->scalarval();
      $domain_orders[$keyname]['domain_name'] = $data['domain_name']->scalarval();
      $domain_orders[$keyname]['domain_name_idn'] = $data['domain_name_idn']->scalarval();
      $domain_orders[$keyname]['feature_redirect'] = $data['feature_redirect']->scalarval();
      $domain_orders[$keyname]['feature_dns'] = $data['feature_dns']->scalarval();
    //writes the array into the array "value"
    $value['domain_orders'] = $domain_orders;
  return $value;    

//calls the function
$result = domain_get_domain_orders($host,$port,$username,$password,$api_path);

  echo "Status: ".$result['status']."<br><br>";

  //writes the array "server_details" into "daten"
  $daten = $result["domain_orders"];

  //gets the array_keys(members)
  $datenkeys = array_keys($daten);

  //counts the arraykeys, the number of arraykeys will be used in the do-while construct
  $anzahlkeys = count($datenkeys);

    //outputs the data
    echo " <u>order_id:</u> ".$datenkeys[$k];
    echo " <u>domain_id:</u> " . $daten[$datenkeys[$k]]['domain_id'];
    echo " <u>domain_name:</u> ".$daten[$datenkeys[$k]]['domain_name'];
    echo " <u>domain_name_idn:</u> ".$daten[$datenkeys[$k]]['domain_name_idn'];
    echo " <u>feature_redirect:</u> ".$daten[$datenkeys[$k]]['feature_redirect'];
    echo " <u>feature_dns:</u> ".$daten[$datenkeys[$k]]['feature_dns'];
    echo "<br>";

  echo "faultCode: ".$result['faultCode']." faultString: ".$result['faultString'];