process() public method

Process an OpenSRS Request.
public process ( string $format = '', string $data = '' )
$format string input format (xml, json, array)
$data string data
Esempio n. 1
0
 /**
  * Valid submission should complete with no
  * exception thrown.
  *
  *
  * @group validsubmission
  */
 public function testValidLiveSubmission()
 {
     $data = array('func' => 'lookupGetDomain', 'attributes' => array('domain' => 'phptest' . time() . '.com', 'type' => 'all_info'));
     $request = new Request();
     $ns = $request->process('array', $data);
     $this->assertTrue($ns instanceof GetDomain);
     $this->assertTrue($ns->resultRaw['is_success'] == 1);
 }
 /**
  * Valid submission should complete with no
  * exception thrown. This test runs the call
  * through the RequestFactory.
  */
 public function testValidSubmissionRequestFatory()
 {
     $data = json_decode(json_encode($this->validSubmission));
     $data['func'] = $this->func;
     $request = new Request();
     $ns = $request->process('array', $data);
     $this->assertTrue($ns instanceof CookieQuit);
 }
function processOpenSRS($type = '', $data = '')
{
    try {
        $request = new Request();
        return $request->process($type, $data);
    } catch (Exception $e) {
        trigger_error($e->getMessage(), E_USER_WARNING);
    }
}
     for ($i = 0; $i < $size; ++$i) {
         array_push($formSelectedDomainArray, $tld[$i]);
     }
 }
 // Put the data to the proper form - ONLY FOR TESTING PURPOSE!!!
 $callstring = '';
 $callArray = array('func' => $formFunction, 'data' => array('domain' => $formSearchWord, 'selected' => implode(';', $formSelectedDomainArray), 'alldomains' => implode(';', $allDomainArray)));
 if ($formFormat == 'json') {
     $callstring = json_encode($callArray);
 }
 if ($formFormat == 'yaml') {
     $callstring = Spyc::YAMLDump($callArray);
 }
 try {
     $request = new Request();
     $osrsHandler = $request->process('json', json_encode($callArray));
     // var_dump($osrsHandler->resultRaw);
     echo $osrsHandler->resultFormatted;
 } catch (\opensrs\Exception $e) {
     var_dump($e->getMessage());
 }
 // Open SRS Call -> Result
 // require_once dirname(__FILE__) . "/../..//opensrs/openSRS_loader.php";
 // $osrsHandler = processOpenSRS ($formFormat, $callstring);
 //
 //
 // // Print out the results
 // echo (" In: ". $callstring ."<br>");
 // echo ("Out: ". $osrsHandler->resultFormatted);
 //
 //
<?php

$callArray = array('func' => 'GetDeletedDomains');
require __DIR__ . '/../vendor/autoload.php';
use opensrs\Request;
try {
    $request = new Request();
    $osrsHandler = $request->process('array', $callArray);
    var_dump($osrsHandler->resultRaw);
} catch (\opensrs\Exception $e) {
    var_dump($e->getMessage());
}
Esempio n. 6
0
<?php

$callArray = array('func' => 'premiumDomain', 'data' => array('domain' => 'hockey.com', 'selected' => '.com;.net;.org', 'alldomains' => '.com;.net;.org'));
// require_once '../opensrs/openSRS_loader.php';
require __DIR__ . '/../vendor/autoload.php';
use opensrs\Request;
//JSON
// $callstring = json_encode($callArray);
$json = '{"func":"provSWregister","data":{"auto_renew":0,"domain":"serviciosprofesionales.live","handle":"process","f_lock_domain":1,"f_whois_privacy":false,"reg_type":"new","reg_username":99391876,"reg_password":"******","period":1,"custom_tech_contact":1,"custom_nameservers":1,"name1":"ns1.wordpress.com","name2":"ns2.wordpress.com","name3":"ns3.wordpress.com","sortorder1":1,"sortorder2":2,"sortorder3":3,"personal":{"first_name":"Roberto","last_name":"Salinas","org_name":null,"address1":"5ta calle pte, Barrio San Miguel","address2":null,"city":"Ilobasco","state":"Cabanas","postal_code":"503","country":"SV","phone":"50378284690","fax":null,"email":"*****@*****.**"}}}';
try {
    $request = new Request();
    $osrsHandler = $request->process('json', $json);
    // $osrsHandler = $request->process('json', $callstring);
    var_dump($osrsHandler->resultRaw);
    //YAML
    // $callstring = Spyc::YAMLDump($callArray);
    // $osrsHandler = processOpenSRS ("yaml", $callstring);
    //$callstring = XML($callArray);
    //$osrsHandler = processOpenSRS ("xml", $callstring);
    // echo (' In: '.$callstring.'<br>');
    //echo ("Out Result Full Raw: ". $osrsHandler->resultFullRaw ."<br>");
    //echo ("Out Results Formatted: ". $osrsHandler->resultFormatted ."<br>");
    //Array
    // $variable = var_dump($osrsHandler->resultRaw, true);
    // $variable = str_replace ("\n", "<br>\n",  $variable);
    // echo ('Out Results Formatted: '.$variable);
} catch (\opensrs\Exception $e) {
    var_dump($e->getMessage());
} catch (\opensrs\APIException $e) {
    var_dump($e->getMessage());
    var_dump($e->getInfo());