Brett
Brett

Reputation: 20049

curl_exec() returned data and the status code returned

I'm just wondering, when using cURL and you get the results of the cURL operation via:

$ch = curl_init('www.example.com');
.......
$response = curl_exec($ch);

... and then get the status code via:

$response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

If the status code returned to $response_code is anything BUT 200 does that mean that curl_exec will always return false?

Upvotes: 0

Views: 45

Answers (1)

Avinash Babu
Avinash Babu

Reputation: 6252

Curl_exec wont return false if the status code returned is even 200.

As @krister mentioned you will get get a value response(returns the result) if the status code is even 301.

Upvotes: 1

Related Questions