I have to access the following url in my PHP code .
the above url returns a json response. My query is " how to retrieve the response in php code ".
Please provide a code sample for this as i'm quite new in this area of php !
I have to access the following url in my PHP code .
the above url returns a json response. My query is " how to retrieve the response in php code ".
Please provide a code sample for this as i'm quite new in this area of php !
Use PHP JSON junctions json_decode and json_encode http://php.net/manual/en/function.json-encode.php
$json = file_get_contents("https://test.httpapi.com/api/domains/available.json?auth-userid=0&auth-password=password&domain-name=domain&tlds=com&tlds=info&tlds=org&tlds=net&suggest-alternative=true");
$myArr = json_decode($json);
var_dump($myArr);
$json = file_get_contents("https://test.httpapi.com/api/domains/available.json?auth-userid=0&auth-password=password&domain-name=domain&tlds=com&tlds=info&tlds=org&tlds=net&suggest-alternative=true");
$response = json_decode( stripslashes($json) );
should work quite well