mardi 22 mai 2018

Need to call the function after submit the form using laravel

Need to call the the function after submit the form. In my controller contains two api calls.I need to call the first API and get the "sld" value from that and pass the "sld" value to second API Url after that execute the Second API. But i got a two api output at the same time. please suggest any solution to call the first api after that display the second API data.

My Controller Code

    public function domaincheck(Request $request)
       {
    ini_set('max_execution_time', 300);
    //set_time_limit(300);
        $sld = $request['sld'];
        $tld = $request['tld'];
        $response = file_get_contents('https://reseller.enom.com/interface.asp?command=check&sld='. $sld .'&tld='. $tld .'&uid=resellid&pw=resellpw&responsetype=xml');  
        $data = simplexml_load_string($response);
        $configdata   = json_encode($data);
        $final_data = json_decode($configdata,true);// Use true to get data in array rather than object
        // dd($final_data);



        $response1 = file_get_contents('http://reseller.enom.com/interface.asp?command=GETNAMESUGGESTIONS&uid=resellid&pw=resellpw&SearchTerm='. $sld .'&MaxResults=50&ResponseType=XML');       
        $data1 = simplexml_load_string($response1);
        $configdata1   = json_encode($data1);
        $final_data1 = json_decode($configdata1,true);// Use true to get data in array rather than object
        //dd($final_data1);

        }

My View Code

 <form class="form-horizontal" method="get"> 


  <div class="form-group">
     <div class=" col-lg-2"></div>
     <div class="col-lg-8">
         <div class="input-group m-b">
            <span class="input-group-addon" style="padding-left:10px; background-color: #999;" class='unclickable'>www</span>
            <input type="text" name="sld" class="form-control">
  <span class="input-group-addon">

  <select class="form-control" name="tld" style="width: 100px;">

  <?php $j = 0; ?>
  @foreach($final_data2['tldlist']['tld'] as $value)
  <?php $j++; ?> 
  @endforeach

  @for ($i = 0; $i < $j-1;)
  <option value=""></option>

  <?php $i++; ?> 
  @endfor


      </select>  
      </span>
      <span class="input-group-addon">
      <button type="submit" class="btn btn-sm btn-success" >Submit</button>  
      </span>
      </div>
      <p class="text-center text-dark customFont" >
                    @foreach($final_data as $key=>$value)
                      @if($key=='DomainName')
                        <b></b> <b>-</b>
                      @endif 
                      @if($key=='RRPText')
                          <b></b>
                      @endif
                    @endforeach
                </p>



  @foreach($final_data1['DomainSuggestions']['Domain'] as $value)

  <br>

  @endforeach

Please suggest any solution to solve this issue



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2IC2K60
via IFTTT

Aucun commentaire:

Enregistrer un commentaire