Forums

Get Curl Post Http Code Response

WorldWideCode 17 Feb, 2020
Hi,
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 18 Feb, 2020
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']

Bob
This topic is locked and no more replies can be posted.