LoginSignup
3
3

More than 5 years have passed since last update.

注文検索API をPHPで動かしたいのですがヘルプお願いします・・・

Last updated at Posted at 2014-12-05

注文検索APIを利用し注文情報をとりたいのですが、いろんなサンプルを参考に見よう見まねで
なんとかエラーはでなくなったのですがリクエストの結果が何もレスポンスされずどうしたものかと問い合わせてみました。
Windows環境でPHPを動かしています。
こんな感じでバッチファイルから実行しています。
c:> php sample.php

テスト環境でのアプリケーションIDは取得済みでそれを設定しています。

初歩的なところでわかってないかもしれません。ご教示いただけると大変助かります。

デベロッパーネットワーク様よろしくお願い致します。

こちらがソースです。

<?php

$url = "https://test.circus.shopping.yahooapis.jp/ShoppingWebService/V1/orderList";
$appid = '取得したテスト用アプリケーションIDを設定';

$xml =<<<XML
<Req>
<SellerId>ストアーアカウントを設定</SellerId>
<Search>
<Field>OrderId</Field>
<Condition>
<OrderTimeFrom>20141201000000</OrderTimeFrom>
</Condition>
</Search>
</Req>
XML;

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Yahoo AppID: $appid");
curl_setopt($ch, CURLOPT_HTTPHEADER, ```array('Content-Type: application/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);

$result = curl_exec($ch);
curl_close($ch);
echo $result;

?>
3
3
9

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3