dongpaozhi5734 2015-12-01 12:13
浏览 62
已采纳

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

This question has been asked before, however the answers did not match the api im using.

Essentially the API i am using is split up into different functions just to get ALL domain names owned by 1 customer i selected. As the array is in soap and comes out in arrays im having to put them in loops. This makes it extremely slow with 400 results and having to loop through each individually with seperate queries 3 times or so. I am hoping i can run them in 1 instead of multiple queries however it seems far past my coding abilities.

//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 Documentation here: http://docdro.id/jzpZNdv

  • 写回答

1条回答 默认 最新

  • duanbing2963 2016-09-09 13:52
    关注

    from what i can see it does not have the ability too. It is on a per call basis and doesnt except arrays.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题