$ch = curl_init();
$url = "https://loquesea";
$dataArray = [
'dir' => "",
'phone' => 66666666,
'cp' => '{"loquesea":"xxx"}'
];
$data = http_build_query($dataArray);
$getUrl = $url."?".$data;
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $getUrl);
curl_setopt($ch, CURLOPT_TIMEOUT, 80);
$response = curl_exec($ch);
if(curl_error($ch)){
echo Request Error:' . curl_error($ch);
}else{
echo $response;
}
curl_close($ch);
CURL enviando parámetros por GET: HTTP request failed! HTTP/1.1 400 Bad Request
Si al mandar un CURL por GET da el error de HTTP request failed! HTTP/1.1 400 Bad Request mandar los datos de GET de la siguiente manera:
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario