user10916565
user10916565

Reputation:

PHP "echo" not working before curl function


  funtion request(){

  echo "Success";

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_TIMEOUT, $request_timeout);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $request_timeout);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $response = curl_exec($ch);
  $curl_error = curl_errno($ch);
  $getserver = curl_getinfo($ch);
  curl_close($ch);
}

here success echo only shows after exicuting curl function . i wanna echo the success message before curl function calls.

Upvotes: 0

Views: 246

Answers (1)

İbrahim
İbrahim

Reputation: 130

If this code is in the controller and you are calling from a different function in the same file, you need to call $this->request(), let me convey this information.

Later,

maybe you can return a result with return "Success";

Upvotes: 0

Related Questions