curl to return server response
-
Hi. I am sure this has been asked a few times but i cant find any clear code for this. i am using the curl classes to download data from a HTTP server, is there any ready code for requesting HTML and that the function returns that? (Not through a callback function)? Thanks
-
Hi. I am sure this has been asked a few times but i cant find any clear code for this. i am using the curl classes to download data from a HTTP server, is there any ready code for requesting HTML and that the function returns that? (Not through a callback function)? Thanks
Not sure what cURL classes you're using as there's plenty kicking around but if you're using the easy interface:
curl_easy_getinfo
with a code ofCURLINFO_RESPONSE_CODE
will give you the response code for a given transfer. Or zero if the headers haven't been recieved yet. Cheers, Ash