File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use WC_API_Client ;
4
+ use WC_API_Client_Exception ;
5
+
6
+ $ options = array (
7
+ 'debug ' => true ,
8
+ 'return_as_array ' => false ,
9
+ 'validate_url ' => false ,
10
+ 'timeout ' => 30 ,
11
+ 'ssl_verify ' => false ,
12
+ );
13
+
14
+ try {
15
+ $ client = new WC_API_Client (
16
+ 'http://your-store-url.com ' ,
17
+ 'ck_enter_your_consumer_key ' ,
18
+ 'cs_enter_your_consumer_secret ' ,
19
+ $ options
20
+ );
21
+
22
+ // index
23
+ //print_r($client->index->get());
24
+
25
+ // For other endpoints, see example.php
26
+
27
+ } catch (WC_API_Client_Exception $ e ) {
28
+ echo $ e ->getMessage () . PHP_EOL ;
29
+ echo $ e ->getCode () . PHP_EOL ;
30
+
31
+ if ($ e instanceof WC_API_Client_HTTP_Exception) {
32
+ print_r ($ e ->get_request ());
33
+ print_r ($ e ->get_response ());
34
+ }
35
+ }
You can’t perform that action at this time.
0 commit comments