Hello! I am trying to send a json in the following way
$factura ->acciones = array('enviar_xml_firmado' => false );
$ch = curl_init($url); $jsonDataEncoded = json_encode($factura);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization )); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS,$jsonDataEncoded); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $result = curl_exec($ch); curl_close($ch); return json_decode($result);
but I get the error $HTTP_RAW_POST_DATA de php 5.6, in which part or in what form should I go $data = json_decode( file_get_contents( 'php://input' ), true );
so that it works well?
Hi there, were you able to solve the issue?
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hello! I am trying to send a json in the following way
$factura ->acciones = array('enviar_xml_firmado' => false );
$ch = curl_init($url);
$jsonDataEncoded = json_encode($factura);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$jsonDataEncoded);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
curl_close($ch);
return json_decode($result);
but I get the error $HTTP_RAW_POST_DATA de php 5.6, in which part or in what form should I go
$data = json_decode( file_get_contents( 'php://input' ), true );
so that it works well?
Hi there, were you able to solve the issue?