Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $p_params = array();
  5. $url = 'http://orlof.is/Api/Server.php';
  6. $p_params['union'] = 'slfi';
  7.  
  8. $p_params['appid'] = 'ZhGkYhUcV5tP';
  9. $p_params['appkey'] = '60bzlr1t9servnd8r9rxawu25csz7r4c';
  10.  
  11. /* start date and the end date, at least has one day for renting */
  12. //echo date("w").'<br/>';
  13. if(date("w") != 6 && date("w") != 0){
  14. //now is not weekend, so get this week's weekend
  15. $beginDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+(5-date("w")),date("Y")));
  16. $endDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+(6-date("w")),date("Y")));
  17. }elseif(date("w") != 6){
  18. //now is Saturday
  19. $beginDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+6,date("Y")));
  20. $endDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+7,date("Y")));
  21. }else{
  22. $beginDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+5,date("Y")));
  23. $endDate = date("Y-m-d", mktime(0,0,0,date("m"),date("d")+6,date("Y")));
  24. }
  25.  
  26. $p_params['_period'] = "=".date("Y-m-d",strtotime($beginDate." +1 day"));
  27. $p_params['method'] = "Property.Find";
  28. $p_params['start'] = "0";
  29. $p_params['limit'] = "999999999";
  30. $p_params['attr'] = "no";
  31.  
  32. // ---------------------------------
  33. // Ugly Debug
  34. // ---------------------------------
  35. print_r($p_params);
  36. // print_r($url);
  37. // echo "<pre>";
  38.  
  39. $sign_tmp = "";
  40. foreach ((array)$p_params as $key => $value) {
  41. $sign_tmp .= $value;
  42. }
  43. $p_params['sign'] = md5(md5($sign_tmp));
  44.  
  45. $ch = curl_init();
  46. //set the url, number of POST vars, POST data
  47. curl_setopt($ch, CURLOPT_URL,$url);
  48. curl_setopt($ch, CURLOPT_POST,count($p_params));
  49. curl_setopt($ch, CURLOPT_POSTFIELDS,$p_params);
  50. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  51. $response = curl_exec($ch);
  52. $res = "";
  53. if($response){
  54. $res = json_decode($response);
  55. }
  56.  
  57. // ---------------------------------
  58. // Ugly Debug
  59. // ---------------------------------
  60. print_r($res);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement