title: PHP - Wait for response
body: <p><br>
  I'm having simple script which comunicate via REST with some server.
  Server architecture have some holes, and I fight with one of them right now.
  When I send one request to assign some profile and don't wait for response and send second request. 
  It basicly just scrap the first request and do the second one only.</p>
  
  <p>My code looks like:</p>
  
  <pre><code>$this-&gt;assignProfile($token, $id, FIRST);   
  $this-&gt;assignProfile($token, $id, SECOND);  
  </code></pre>
  
  <p>My Assign profile method looks like:</p>
  
  <pre><code>public function assignProfile($token, $organizationId, $profileId)
  {
      //define enviroment and path
      $host = enviroment;     
      $path = "/admin/members/".$organizationId."/assigned-profiles";
  
      $data_string = '["'.$profileId.'"]';    
  
      // set up the curl resource
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $host.$path);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
      curl_setopt($ch, CURLOPT_HEADER, false);
      curl_setopt($ch, CURLOPT_VERBOSE, true);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);        
      curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
          'Content-Type: application/json',                                                                                
          'Authorization: Bearer '.$token.'',      
          'Content-Length: ' . strlen($data_string)                                                                       
      ));
  
      echo "&lt;br&gt;OK&lt;br&gt;";
      // execute the request      
      $output = curl_exec($ch);       
      curl_close($ch);    
  } 
  </code></pre>
  
  <p>The thing is, webservice is not response with any body or something, it just response with code 200.
  How can I code this to wait for a 200 and than continue with second request.</p>