CURLOPT_POST, the request fails

Viewed 19

I want to consume a web service by post method, and I have these fields:

enter image description here

and I am sending the information in this way;

  $post_fields = array('nombre' => 'uno', 'apellido' => 'dos');

PHP code:

  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_POST, 1);
  curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query( $post_fields ) );
  $resp = curl_exec($curl);
  curl_close($curl);
  var_dump($resp);

But it does not bring me information. Does anyone know how to receive the data or what my error is?

0 Answers
Related