0
Good evening, I need to return data from a site specific to my application, for this I chose to use the Curl() PHP method, in it I send a post and return the information I want, the problem is that in this return comes the full page of the form that Acessei, I didn’t find any way to just get input data from that form. I need to capture the information returned from the form and pass to json.
Here is the method that performs this search:
public function busca(Request $request){
$data = $request->all();
$cURL = curl_init('http://www.site.com.br/resultado.php');
curl_setopt($cURL, CURLOPT_HEADER, false);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
$dados = array(
'num_cnpj' => $data['cnpj'],
'botao' => 'Consultar'
);
curl_setopt($cURL, CURLOPT_POST, true);
curl_setopt($cURL, CURLOPT_POSTFIELDS, $dados);
curl_setopt($cURL, CURLOPT_REFERER, 'http://www.site.com.br/index.php');
$resultado = curl_exec($cURL);
curl_close($cURL);
return $resultado;
}
The information is returned within Inputs? If possible add the returned HTML (at least in the chunk you want to get the data).
– Inkeliz
Yes, it works as if it takes a copy of the full page where the data is returned from the original site, and the data I want to capture is inside the inputs.
– let