Is it possible to convert this cURL code to Guzzle?
$ch = curl_init('whois.nic.co');
curl_setopt($ch, CURLOPT_PORT, 43);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "example.co\r\n");
$response = curl_exec($ch);
curl_close($ch);
Tried with this code but doesn't seems to be working.
$client = new Client(['base_uri' => 'whois.nic.co:43']);
$request = $client->post('', array('Content-Type' => 'text/plain; charset=UTF8'), "example.co\r\n");
$response = $request->send();
The code above return error: cURL error 0: The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in the same error. Turn on the debug option to see what went wrong. See https://bugs.php.net/bug.php?id=47204 for more information. (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)