# steamのAPIを使用して積みゲーを調べてみました.積みゲー有り
おはようございます.xAIの申請に通らなかったので来月のQiitaの投稿を何にしようかなと考えてた所、ふと積みゲーのことが頭に浮かんできたので、Steam APIとかあるのかなと調べてみました.そしたらAPIが在ったのでさっそく作ってみました.
ソースコードはgithubにもあげているので試してみてください.こちらのソースコードをコピペするよりお手軽ですよ.
<https://github.com/taoka3/steam/tree/main>
```
<?php
require 'config.php';
class steam
{
public $result;
public function getOwnedGames($urls = 'http://api.steampowered.com/IPlayerService/GetOwnedGames/v1/?')
{
$params = http_build_query([
'key'=>APIKEY,
'steamid'=>STEAMID,
'include_appinfo'=>1,
'include_played_free_games'=>0,
//'appids_filter'=>''
]);
$this->result = file_get_contents($urls.$params,true);
return $this;
}
public function viewOwnedGames()
{
$data = json_decode($this->result);
foreach($data->response->games as $val){
$tumiGames = (int)$val->playtime_forever === 0?' [積みゲー]':'';
printf('ゲーム名:%s プレイ時間:%02d時%02d分%s<br>',$val->name,(int)($val->playtime_forever / 60),(int)($val->playtime_forever % 60),$tumiGames);
}
return $this;
}
}
(new steam)->getOwnedGames()->viewOwnedGames();
```
因みに実行結果は下記になります.
明日へ続く.
[  考え過ぎずに行動力.逆算出来れば凄いけどね.
](https://zip358.com/2026/02/07/%e8%80%83%e3%81%88%e9%81%8e%e3%81%8e%e3%81%9a%e3%81%ab%e8%a1%8c%e5%8b%95%e5%8a%9b-%e9%80%86%e7%ae%97%e5%87%ba%e6%9d%a5%e3%82%8c%e3%81%b0%e5%87%84%e3%81%84%e3%81%91%e3%81%a9%e3%81%ad.html)
[  ネガティブ思考は駄目なのか本当にそう?
](https://zip358.com/2026/02/06/%e3%83%8d%e3%82%ac%e3%83%86%e3%82%a3%e3%83%96%e6%80%9d%e8%80%83%e3%81%af%e9%a7%84%e7%9b%ae%e3%81%aa%e3%81%ae%e3%81%8b%e6%9c%ac%e5%bd%93%e3%81%ab%e3%81%9d%e3%81%86%ef%bc%9f.html)
[  成功体験と成功の模倣.
](https://zip358.com/2026/02/05/%e6%88%90%e5%8a%9f%e4%bd%93%e9%a8%93%e3%81%a8%e6%88%90%e5%8a%9f%e3%81%ae%e6%a8%a1%e5%80%a3.html)
[  サイトを分離した話を黙々と書いていきます.
](https://zip358.com/2026/02/04/%e3%82%b5%e3%82%a4%e3%83%88%e3%82%92%e5%88%86%e9%9b%a2%e3%81%97%e3%81%9f%e8%a9%b1%e3%82%92%e9%bb%99%e3%80%85%e3%81%a8%e6%9b%b8%e3%81%84%e3%81%a6%e3%81%84%e3%81%8d%e3%81%be%e3%81%99.html)
[  半額セールでアドビ様を延長.
](https://zip358.com/2026/02/03/%e5%8d%8a%e9%a1%8d%e3%82%bb%e3%83%bc%e3%83%ab%e3%81%a7%e3%82%a2%e3%83%89%e3%83%93%e6%a7%98%e3%82%92%e5%bb%b6%e9%95%b7.html)