Kindly help me with this issue. Before submitting the form in a variable called "$data" I have the data as below:
{ "message": "Required parameter missing: domain-name", "status": "ERROR" }
And after submitting the value in the form, in the same variable called "$data", I have the below data.
 {"decksys.com":{"classkey":"domcno","status":"available"}}
Now I need to display the "decksys.com" and the status "available".Find below my code and kindly help me to solve this issue.
Controller Code:
  class AvailableController extends Controller
  {
     public function create(Request $request)
     {
        $domainname = Input::get('domainname');
        $tld = Input::get('tld');
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_URL, 'https://httpapi.com/api/domains/available.json?auth-userid=711757&api-key=74miSZPgYkkc108Ptmeo5Q8iDTtKk3xi&domain-name='.$domainname.'&tlds='.$tld.'');
        $result = curl_exec($ch);
        curl_close($ch);
        $data = json_encode($result);
        $response = json_decode($data);
       // $result = json_decode($response);
       $data = json_decode($response, true);
        return view('clientlayout.main.tld',compact('data'));
     }
    }
View Page:
     @foreach($data as $key => $value)
     @if ($data['status'] == 'ERROR')
       
     @endif
     @endforeach
Here it checks the status correctly and displays "ERROR". But after submitting the form I'm getting the error as: "Undefined index: status ". Kindly help me to solve this issue.
via Chebli Mohamed
 
Aucun commentaire:
Enregistrer un commentaire