1个请求中的API而不是多个循环

时间:2015-12-01 12:13:37

标签: php api loops

之前已经提出过这个问题,但答案与api即时使用不符。

基本上我正在使用的API被分成不同的功能,只是为了让我选择的1个客户拥有所有域名。因为数组在soap中并且在数组中出现,我必须将它们放在循环中。这使得它非常慢,有400个结果,并且必须单独循环查看每个单独的查询3次左右。我希望我可以在1而不是多个查询中运行它们,但它似乎远远超过了我的编码能力。

//include the required files
require_once('includes/config.php');
require_once('classes/reseller_api.php');

//initialise the base reseller_api object
$reseller_api = new reseller_api();

//construct the request data

//send the request
$response = $reseller_api->call('GetDomainList', $request);


$decodedresponse = json_encode( $response, true );
$decoded_response = json_decode( $decodedresponse, true );

$loadeddata = $decoded_response['APIResponse']['DomainList'];

foreach ($loadeddata as $key => $value) {

    $domainnameis = $value['DomainName'];
    $domainnamestatus = $value['Status'];
    $domainnameexpiry = $value['Expiry'];

    $domainnameexpiry2 = date('d-m-Y',strtotime($domainnameexpiry));

?>
   <tr>
   <?php
         /// GET THE DOMAIN NAME OWNER ID
        $request2 = array(
        'DomainName' => $value['DomainName']
        );

        $response2 = $reseller_api->call('DomainInfo', $request2);

        if (isset($response2->APIResponse->DomainDetails)) {
            $domainownerident = $response2->APIResponse->DomainDetails->RegistrantContactIdentifier;



        /// NOW IF THE OWNER ID CAME BACK, GRAB THE NAME OF THE OWNER
        $request3 = array(
        'ContactIdentifier' => $domainownerident
        );

        $response3 = $reseller_api->call('ContactInfo', $request3);


         /// NOW WE HAVE THE OWNER, SEE IF ITS OWNED BY HEAD OFFICE AND LAUNCH IT

         if ($response3->APIResponse->ContactDetails->FirstName == "Reece") {

            ?>
        <td <?php echo $domainbckstyle; ?>><?php echo $domainnameis; ?></td>
        <td><?php echo $regback; ?></td>
        <td <?php echo $domainbckstyle; ?>><?php echo $domainnameexpiry2; ?></td>
    </tr>
    <?php }}}} ?>

此处的API文档:http://docdro.id/jzpZNdv

1 个答案:

答案 0 :(得分:0)

从我所看到的它也没有这种能力。它是基于每个调用而不是数组。