Skip to main content

Posts

Showing posts with the label Curl

Check curl status

We can check curl status as below $curl = curl_init(); curl_setopt($curl,CURLOPT_URL,'https://esoftsolutions4u.blogspot.com'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($curl); $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); If $http_status = 200,then we have correct response. If ($http_status ="" || $http_status ="failed" ) then we have failed response or some error in the response.

Curl retrieval of page or url

Simple way of retrieving data from an URL  using CURL $curl = curl_init(); curl_setopt($curl,CURLOPT_URL,'https://esoftsolutions4u.blogspot.com'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($curl); $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl);