Buy Now
Sign in

Get Curl Post Http Code Response

WorldWideCode , February 17 2020, 13:44
WorldWideCode 6
February 17 2020, 13:44 #391233
maybe is more simple than I think.
In my form I post data to a target url using cUrl action.
I need to get response http code (i.e 200, 500, ...) but I can't find the way. Using debug Info I noticed I get textual Http response in $form->data['curl'].
I can see also curl info in debug info section with data I'll need :
How can I accessit? In custom code now I'm using :
<?php echo $form->data['curl'] ?>
but I need to change this code accordingly with response status code.
Consider Api controller I post data to, return an HttpResponseMessage like this :
var resp = new HttpResponseMessage(HttpStatusCode.OK);
resp.Content = new StringContent(string.Format("Rapporto '{0}' ricevuto con successo", 'id'));
return resp;
Please let me know if you need further informations.
Thanks in advance
GreyHead 64
February 18 2020, 16:12 #391254
Hi WorldWideCode,
I'm not clear exactly what the problem is that you are having? You should be able to access the data in PHP using for example $form->data['Curl']['http_code']
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much