json - PHP Curl and reseller domain availability checker -
i requesting data heart internet's domain availability checker using php curl function. have got working fine, there 1 thing not sure how working.
there incremental search option data retrieved when ready, rather waiting process finish. possible take advantage of using php , curl? document states:
incremental: optional, boolean. if true, results come in, in form of series of newline-separated json objects, see "incremental searching" below.
and also:
if want give fastest possible response, should use incremental searching. means instead of waiting results, try perform several searches @ once , output each result comes in. in same format non-incremental mode except no "complete" property , newline ("\n") @ end. once results have been produced, single json object should equivalent empty search result.
for example: {"lookup":[{"name":"example.org","reason":"registered","avail":0}]} {"lookup":[{"name":"example2.org","reason":"registered","avail":0}]} {"lookup":[],"premium":[],"category":[],"complete":1}
please note more 1 domain name per result in format.
my code follows:
$access_token = "mytoken"; $access_token_64 = base64_encode($access_token); $data = array("name" => array("domianexample.co.uk", "domianexample.com", "domainexample.net", "domianexampletwo.com", "domainexampletwo.net"), "incremental " => true); $data_string = json_encode($data); $ch = curl_init('http://api.heartinternet.co.uk/cx/dac.cgi'); curl_setopt($ch, curlopt_customrequest, "post"); curl_setopt($ch, curlopt_postfields, $data_string); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_httpheader, array( 'authorization: bearer ' . $access_token_64, 'content-type: application/json', 'content-length: ' . strlen($data_string)) ); $result = curl_exec($ch);
any or hints gratefully appreciated.
Comments
Post a Comment