extract($sign_param); $sign_param = http_build_query($sign_param); $hmac = hash_hmac('sha256', $sign_param, $secret_access_key, true); $signature = base64_encode($hmac); // echo 'parameters : ' . $sign_param . ' <br> ' . 'HMAC-SHA256 : ' . $hmac . " <br> base64 = " . $signature; $data = ['access_key_id' => $access_key_id, 'from_time_stamp' => $from_time_stamp, 'main_land' => $main_land, 'signature' => $signature, 'version' => $version, 'client_time_stamp' => $client_time_stamp]; $data = http_build_query($data); $request = $url . $func_name . '?' . $data; #way1 ############################### $body = file_get_contents($request); var_dump($request, $body); ############################### #way2 ############################### $curl = curl_init(); curl_setopt_array($curl, array(CURLOPT_URL => $request, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 5, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array("cache-control: no-cache"))); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { var_dump($response); } ############################### } $param = ['url' => "http://api.hoteldari.ir/asacrs/api/", 'access_key_id' => 'KXNheFQzfmRdVkZ+cTc2', 'secret_access_key' => '#xN8#zz9FZ28W84f#&KcDc&VCJprxt-xgkT_%QP3', 'func_name' => 'cities', 'version' => "5", 'client_time_stamp' => '0000-00-00 00:00:00']; $sign_param = array('from_time_stamp' => '0000-00-00 00:00:00', 'main_land' => 1); asa_client($param, $sign_param);
$response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { print_r($response); } echo "<br>"; } #################################################### $params = ["url" => "http://api.hoteldari.ir/asacrs/api/", "auth" => ["access_key_id" => "KXNheFQzfmRdVkZ+cTc2", "secret_access_key" => "#xN8#zz9FZ28W84f#&KcDc&VCJprxt-xgkT_%QP3"], "version" => "5", "client_time_stamp" => "0000-00-00 00:00:00"]; #################################################### $cities_sign_params = ["from_time_stamp" => "0000-00-00 00:00:00", "main_land" => "0"]; //asa_client('GET', 'cities', $params, $cities_sign_params); #################################################### $hotels_sign_params = ["from_time_stamp" => "0000-00-00 00:00:00", "id_city" => "0", "id_hotel" => "0"]; //asa_client('GET', 'hotels', $params, $hotels_sign_params); #################################################### $room_kind_sign_params = ["from_time_stamp" => "0000-00-00 00:00:00", "id_hotel" => "0"]; //asa_client('GET', 'roomkinds', $params, $room_kind_sign_params); #################################################### $capacity_sign_params = ["id_hotel" => "0", "id_roomkind" => "0", "from_date" => "2016-01-20", "to_date" => "2016-01-30", "from_time_stamp" => "0000-00-00 00:00:00"]; //asa_client('GET', 'capacities', $params, $capacity_sign_params); #################################################### $reserve_first_step_sign_params = ["id_hotel" => "1", "from_date" => "2016-02-17", "to_date" => "2016-02-18", "room_detail" => [["id_roomkind" => "9", "number" => "1", "adult" => "1", "child" => [1, 1, 1]]]]; asa_client('POST', 'reserve', $params, $reserve_first_step_sign_params); #################################################### $reserve_second_step_sign_params = ["id_reserve_hotel" => "45067", "reserve_detail" => ["last_name" => "ثنایی �ر", "first_name" => "خدابخش", "adress" => "مشهد - تست", "source" => "5897", "telephone" => "021-77651959", "melli_code" => "2120227837", "transfer" => "0", "travel_with" => "1", "nation" => "0", "message" => "ندارد", "mobile" => "09123764208", "flight_number" => "زاگرس ۲۲", "flight_time" => "11 => 15", "clerk" => "علی ولیزاده"]]; asa_client('PUT', 'reserve/85', $params, $reserve_second_step_sign_params);
// ), // )); // // $response = curl_exec($curl); // $err = curl_error($curl); // // curl_close($curl); // // if ($err) // { // echo "cURL Error #:" . $err; // } // else // { // var_dump($response); // } // ############################### // echo "<br>"; } #################################################### $params = ["url" => "http://94.183.153.237/asacrs/api/", "auth" => ["access_key_id" => "KXNheFQzfmRdVkZ+cTc2", "secret_access_key" => "#xN8#zz9FZ28W84f#&KcDc&VCJprxt-xgkT_%QP3"], "version" => "5", "client_time_stamp" => "0000-00-00 00:00:00"]; #################################################### $cities_sign_params = ["from_time_stamp" => "0000-00-00 00:00:00", "main_land" => "0"]; //asa_client('cities', $params, $cities_sign_params); #################################################### $hotels_sign_params = ["from_time_stamp" => "0000-00-00 00:00:00", "id_city" => "5201", "id_hotel" => "0"]; //asa_client('hotels', $params, $hotels_sign_params); #################################################### $room_kind_sign_params = ["from_time_stamp" => "0000-00-00 00:00:00", "id_hotel" => "1"]; asa_client('roomkinds', $params, $room_kind_sign_params); ####################################################