Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $p_params = array();
- $url = 'http://orlof.is/Api/Server.php';
- $p_params['union'] = 'slfi';
- $p_params['appid'] = 'ZhGkYhUcV5tP';
- $p_params['appkey'] = '60bzlr1t9servnd8r9rxawu25csz7r4c';
- /* start date and the end date, at least has one day for renting */
- //echo date("w").'<br/>';
- if(date("w") != 6 && date("w") != 0){
- //now is not weekend, so get this week's weekend
- $beginDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+(5-date("w")),date("Y")));
- $endDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+(6-date("w")),date("Y")));
- }elseif(date("w") != 6){
- //now is Saturday
- $beginDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+6,date("Y")));
- $endDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+7,date("Y")));
- }else{
- $beginDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+5,date("Y")));
- $endDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+6,date("Y")));
- }
- $p_params['_period'] = "=".date("Y-m-d",strtotime($beginDate." +1 day"));
- $p_params['method'] = "Property.Find";
- $p_params['start'] = "0";
- $p_params['limit'] = "999999999";
- $p_params['attr'] = "no";
- // ---------------------------------
- // Ugly Debug
- // ---------------------------------
- print_r($p_params);
- // print_r($url);
- // echo "<pre>";
- $sign_tmp = "";
- foreach ((array)$p_params as $key => $value) {
- $sign_tmp .= $value;
- }
- $p_params['sign'] = md5(md5($sign_tmp));
- $ch = curl_init();
- //set the url, number of POST vars, POST data
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_POST,count($p_params));
- curl_setopt($ch, CURLOPT_POSTFIELDS,$p_params);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $response = curl_exec($ch);
- $res = "";
- if($response){
- $res = json_decode($response);
- }
- // ---------------------------------
- // Ugly Debug
- // ---------------------------------
- print_r($res);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement