Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
カラーミーショップ商品取得
<?php
define( 'ACCESS_TOKEN', '{アクセストークンを入れます}' );
$query_str = http_build_query( array(
'category_id_big' => '15', // カテゴリーID
'name' => '商品名', // 取得する商品名のLIKE検索
'display_state' => 'showing', // 表示中の商品だけを取得
'limit' => '5', // 最大取得件数
) );
$url = 'https://api.shop-pro.jp/v1/products.json?' . $query_str;
$response = wp_remote_get( $url, array(
'headers' => array(
'Authorization' => 'Bearer ' . ACCESS_TOKEN
)
) );
if ( wp_remote_retrieve_response_code( $response ) === '200' ) {
$json = wp_remote_retrieve_body( $response );
var_dump( $json );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.