$url = 'https://secure.365villas.com/api/property';
$data = array(
"action" => "create",
"property" => [
"internal_code" => "1",
"name" => "Villas beach on island",
"type" => "Villa",
"brief" => "Luxurious area with famous Saatchi Gallery, Theater Royal, designer shops and fine dining venues.",
"maxguest" => 4,
"bedrooms" => 2,
"bathrooms" => 3,
"kitchens" => 1,
"floor" => "3",
"space" => [
"value" => 100,
"unit" => "meters"
],
"phone" => "1832472313",
"street" => "31 Draycott Ave",
"city" => "London",
"state" => "London",
"country" => "UK",
"latitude" => 51.492,
"longitude" => -0.164,
"allowchildren" => false,
"allowpet" => true,
"allowsmoking" => false
);
$username='guest';
$password='secret';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/x-www-form-urlencoded",
"365villaskey: NTZjMjI4OWM4NzkyYTJkZDM5ZTFlNjNkMzQxZmZmMzRhZjM5YTEzMQ==",
"365villaspass: YmMzZjVkMmUyZTVmYWFlZWYxZjkwNzZmZjcyODhkYmU3ZjY3MmZmYg=="
),
CURLOPT_USERPWD => $username . ":" . $password,
));
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($curl);
curl_close($curl);
$returnData = json_decode($response, true);
print_r($returnData);
Response example data
{
"code": 200,
"data": {
"property_id": "1"
}
}