Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php API在1个请求中,而不是在多个循环中_Php_Api_Loops - Fatal编程技术网

Php API在1个请求中,而不是在多个循环中

Php API在1个请求中,而不是在多个循环中,php,api,loops,Php,Api,Loops,这个问题以前被问过,但是答案与我使用的api不匹配 本质上,我使用的API被分成不同的函数,只是为了得到我选择的一个客户拥有的所有域名。由于数组在soap中,并以数组的形式出现,我不得不将它们放入循环中。这使得它的速度非常慢,有400个结果,并且必须用3次左右的单独查询分别循环每个结果。我希望我可以在1而不是多个查询中运行它们,但是这似乎远远超出了我的编码能力 //include the required files require_once('includes/config.php'); re

这个问题以前被问过,但是答案与我使用的api不匹配

本质上,我使用的API被分成不同的函数,只是为了得到我选择的一个客户拥有的所有域名。由于数组在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 }}}} ?>
//包括所需的文件
require_once('includes/config.php');
需要_once('classes/reseller_api.php');
//初始化基本分销商api对象
$RELESER_api=新的RELESER_api();
//构造请求数据
//发送请求
$response=$reseller\u api->call('GetDomainList',$request);
$decodedresponse=json_encode($response,true);
$decoded_response=json_decode($decodedresponse,true);
$loadeddata=$decoded_响应['APIResponse']['DomainList'];
foreach($loadeddataas$key=>$value){
$domainnameis=$value['DomainName'];
$domainnamestatus=$value['Status'];
$domainnameexpiry=$value['Expiry'];
$domainnameexpiry2=日期('d-m-Y',strottime($domainnameexpiry));
?>

此处的API文档:

据我所知,它也不具备这种能力。它是基于每次调用的,除了数组之外没有其他功能。

完全取决于特定的API-应该有随附的文档如果没有API文档,除了猜测之外真的没有其他方法。此处的API文档: