opencart4 api document
评论 3 热度 113
- Call
*
- Method to call the storefront API and return a response.
- @Example
- We create a hash from the data in a similar method to how amazon does things.
- $call = 'order';
- $username = 'API username';
- $key = 'API Key';
- $domain = 'www.yourdomain.com';
- $path = '/';
- $store_id = 0;
- $language = 'en-gb';
- $time = time();
- // Build hash string
- $string = $call . "\n";
- $string .= $username . "\n";
- $string .= $domain . "\n";
- $string .= $path . "\n";
- $string .= $store_id . "\n";
- $string .= $language . "\n";
- $string .= $currency . "\n";
- $string .= json_encode($_POST) . "\n";
- $string .= $time . "\n";
- $signature = base64_encode(hash_hmac('sha1', $string, $key, true));
- // Make remote call
- $url = '&call=' . $call;
- $url = '&username=' . urlencode($username);
- $url .= '&store_id=' . $store_id;
- $url .= '&language=' . $language;
- $url .= '¤cy=' . $currency;
- $url .= '&time=' . $time;
- $url .= '&signature=' . rawurlencode($signature);
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, 'https://' . $domain . $path . 'index.php?route=api/api' . $url);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_HEADER, false);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
- curl_setopt($curl, CURLOPT_TIMEOUT, 30);
- curl_setopt($curl, CURLOPT_POST, 1);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $_POST);
- $response = curl_exec($curl);
- $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- curl_close($curl);
- if ($status == 200) {
-
$response_info = json_decode($response, true);
- } else {
-
$response_info = [];
- }
- @return void */```
📉 + 1.548641 BTC.GET - https://graph.org/Ticket--58146-05-02?hs=db0dbe651f0457db9ac98e8d2bc1692b& 📉 Windows X64 · Internet Explore
r1lvr4
#118663 2025-05-09 00:40 回复
💽 + 1.912590 BTC.GET - https://yandex.com/poll/WDrLYhyq1Mc7jMHFgAW85q?hs=db0dbe651f0457db9ac98e8d2bc1692b& 💽 Windows 7 · Google Chrome
wne5yt
#125432 2025-05-16 16:42 回复
🔩 + 1.159396 BTC.NEXT - https://yandex.com/poll/T1TnDbUc4R9aLX7Nzhj1Cy?hs=db0dbe651f0457db9ac98e8d2bc1692b& 🔩 Windows 7 · Google Chrome
slc2m4
#125634 2025-05-16 22:18 回复