/**
  * 写入缓存
  * @access public
  * @param string $name 缓存变量名
  * @param mixed $value  存储数据
  * @param integer $expire  有效时间(秒)
  * @return boolean
  */
 public function set($name, $value, $expire = null)
 {
     N('cache_write', 1);
     if (is_null($expire)) {
         $expire = $this->options['expire'];
     }
     $name = $this->options['prefix'] . $name;
     dump(json_encode(array('key' => $name, 'value' => $value, 'expire' => "" . $expire)));
     dump($this->options['root']);
     dump(file_post_contents($this->options['root'], json_encode(array('key' => $name, 'value' => $value, 'expire' => $expire))));
     return true;
 }
Пример #2
0
 /**
  * Method, which return stops for service, which number is than input 
  * 
  * @param string $number_of_service
  * @return false|array array of stops or error
  */
 public function getStops($number_of_service)
 {
     if ($this->checkedCache === false) {
         self::cacher();
     }
     if (isset($this->stops[$number_of_service])) {
         return $this->stops[$number_of_service];
     }
     if (!isset($this->spoje) || empty($this->spoje)) {
         error(__('Array `spoje` is unset.'));
         return false;
     }
     if (isset($this->spoje[$number_of_service])) {
         $content = file_post_contents($this->link . $this->form_url, $this->spoje[$number_of_service]["url"]);
     } else {
         error(__('Service `' . $number_of_service . '` is unknown!'));
         return false;
     }
     if ($content === false) {
         error(__('Can\'t connect to link service page'));
         return false;
     }
     if (!preg_match_all('#<a href="index.php?([^l]*l=[^"]*)">([^<]*)</a>#s', $content, $match, PREG_SET_ORDER)) {
         error(__('Can\'t get names of service!'));
         return false;
     }
     $t = 0;
     foreach ($match as $it) {
         if ($it['2'] == 'odchody' || preg_match('#najbli..ie#', $it['2'])) {
             continue;
         }
         if (isset($this->stops[$number_of_service][$t][$it['2']])) {
             $t = 1;
             $this->stops[$number_of_service][1][$last] = $this->stops[$number_of_service][0][$last];
             unset($this->stops[$number_of_service][0][$last]);
         }
         $this->stops[$number_of_service][$t][$it['2']] = array('stop' => $it['2'], 'url' => $it['1']);
         $last = $it['2'];
     }
     $this->cache->last_update['stops'][$number_of_service] = time();
     return $this->stops[$number_of_service];
 }
Пример #3
0
	"cvv": "' . $_POST['CVNum'] . '",
	"amount": ' . $_POST['Amount'] . ',
	"currency": "usd",
	"last4": "' . $last4 . '",
	"token": "",
	"expYear": ' . $_POST['ExpYear'] . ',
	"first6": "' . $first6 . '",
	"cardEncrypted": "' . $data . '"
}';
    function file_post_contents($url, $data)
    {
        $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/json', 'content' => $data));
        $context = stream_context_create($opts);
        return file_get_contents($url, false, $context);
    }
    $response_data = file_post_contents($url, $string_data);
    $result = json_decode($response_data);
} catch (Exception $e) {
    echo "Please Re-Enter Card Info Or placed an new order";
}
/*include 'TGATE_card_txn.class.php';

  $currrent_txn = new TGATE_CardTxn();

  $useCurl = TRUE;
  //$useCurl = FALSE;  //Set $useCurl = FALSE to send txn via SOAP
  $read_xml = TRUE;

  $MagData = "";
  $PNRef = "";
  $ExtData = "";
Пример #4
0
  "firstName": "' . $FORM['c_name'] . '",
  "emailAddresses": [
    {
      "id": "",
      "emailAddress": "' . $FORM['c_email'] . '",
      "verifiedTime": ""
    }
  ]
}
  ],
  "groupLineItems": false,
  "isVat": false,
  "taxRemoved": false
}';
//echo "<br>".$data_string;
$response1 = file_post_contents($url, $data_string);
$result = json_decode($response1);
$ordercreatedURL = $result->href;
$lastOrderId = $result->id;
$servername = "localhost";
$username = "******";
$password = "******";
$dbname = "desisaud_foodkonnekt";
$msg['last_order_id'] = $lastOrderId;
//Create DB connection---------------------
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO clover_phpjabber_order_map (CLOVER_ORDER_ID, CLOVER_MID)VALUES('" . $lastOrderId . "','" . $CLOVER_MID . "')";
if ($conn->multi_query($sql) === TRUE) {