API経由で配信方法のリストを取得する方法は?
url:http://www.namedoseusite.com.br/api_ds_orders.php?action = calculate_shipping&amtry = l。
<テーブルスタイル= "幅:100%;">
パラメーター | フォーマット | 説明 |
国 | get | 国番号 番号のみが必要です< /td> |
post_code | get | 配送郵便コードが必要です |
products_id | json | APIを使用して注文データをリストしてproduct_id 形式を取得します:int(11)< /td> |
products_quantity | json | 数量番号 番号のみが必要です< /td> |
phpサンプル:
//サンプルCalculate_shipp
$ url = $ tabain_url。 &#39; /api_ds_orders.php?action = calculate_shipping&amp; country =&#39; $ _ get [&#39;]。&#39;&amp; post_code =&#39;# 39; post_code&#39;];
$ data_products [0] = array( "products_id" =&gt; $ _get [&#39; products_id&#39;]、//例:130(番号のみが必要) *フィールドが必要です
「Products_Quantity」=&gt; $ _get [&#39; products_quantity&#39;] //例:1(番号のみが必要です) *フィールドが必要です
);$ data_products [1] = array( "products_id" =&gt; $ _get [&#39; products_id1&#39;]、//例:130(番号のみが必要) *フィールドが必要です
「Products_Quantity」=&gt; $ _get [&#39; products_quantity1&#39;] //例:1(番号のみが必要です) *フィールドが必要です
);$ data = array( "products" =&gt; $ data_products // * field required
);$ data_string = json_encode($ date);
$ ch = curl_init($ url);
curl_setopt($ ch、curlopt_customrequest、 "post");
curl_setopt($ ch、curlopt_postfields、$ data_string);
curl_setopt($ ch、curlopt_returntransfer、true);
curl_setopt($ ch、curlopt_ssl_verifypeer、false);
curl_setopt($ ch、curlopt_httpheader、array(
&#39; content-type:application/json&#39;、
「キャッシュコントロール:キャッシュなし」、
&#39;トークン:&#39; 。 base64_encode($ token)、
&#39;秘密:&#39; 。 base64_encode($ secret)、
&#39;電子メール:&#39; 。 base64_encode($ email)、
&#39;コンテンツレングス:&#39; 。 strlen($ data_string)))
);$ result = curl_exec($ ch);
curl_close($ ch);print_r($ result);
//サンプル計算eof
返品:
id
テキスト< /p>