How do I get the HTTP status code (eg 200 or 500) after calling curl_easy_perform?
相关问题
- Angular RxJS mergeMap types
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- Google Apps Script: testing doPost() with cURL
- How to instantiate Http service in main.ts manuall
The other answer is absolutely correct, but I would also like to add that it might not be wise to check the error code by hand, the
200
code is not the only code that signifies success.I'd recoment using the libcurl option CURLOPT_FAILONERROR that when activated will make libcurl consider
400
and500
-category statuses a request failure and will not returnCURLE_OK
from perform.http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html