I want to use jsonWhois api but it makes the server request using Unirest, which looks like it's no longer maintained and I would prefer to use curl anyway.
How can I convert this code to use Curl instead??
$response = Unirest\Request::get("https://jsonwhois.com/api/v1/whois",
array(
"Accept" => "application/json",
"Authorization" => "Token token=<Api Key>"
),
array(
"domain" => "google.com"
)
);
$data = $response->body; // Parsed body
I've tried curl_setopt($ch, CURLOPT_URL, 'https://jsonwhois.com/api/v1/whois?token=123456&domain=google.com');
, but it says HTTP Token: access denied
.
You can actually use Postman app for something like this. I use it all the time and it works great.
You can simply enter the request into it:
And then simply click on "Code" (top right corner) and go to "PHP" -> "cURL". It will show you the exact code that you have to write to make that request using cURL:
I have no idea what jsonwhois is but, if everything is set up correctly, it should work.