'get_status', 'licence_key' => $licence_key, ); // $headers = ['Content-Type: application/json' ]; // ライセンス用DBに接続 $response = wp_remote_post( \Arkhe::$licence_check_url, array( 'method' => 'POST', 'timeout' => 15, 'redirection' => 5, 'sslverify' => false, 'body' => $send_data, // 'httpversion' => '1.0', // 'blocking' => true, // 'data_format' => 'body', // 'headers' => array(), ) ); if ( is_wp_error( $response ) ) { return array( 'status' => 500, 'error' => 1, 'message' => $response->get_error_message(), ); } // レスポンスを取得(json なので配列にデコード) $get_data = json_decode( $response['body'], true ); // 配列でない場合や、statusが取得できない時は何かデータがおかしい if ( ! is_array( $get_data ) || ! isset( $get_data['status'] ) ) { return array( 'status' => 500, 'error' => 1, 'message' => 'The data format is incorrect.', ); } // 正常なデータ return $get_data; } }