How to use curl in PHP?
Basic curl example
php curl: simple post request and retrival of page example.Just use below code in your script.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.google.com",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
You can check your Response for result as well as a Error.
Leave a Reply