← 記事に戻る
# 数珠繋ぎにTweet(リプライ)するPHP言語のコードは意外にも簡単。

先日、高知県はコロナ感染症が111人になったそうです。早くコロナワクチン接種?2回目を打ちたいです、ただファイザー社のワクチンなのでデルタ株のウィルスは軽症化させるだけで無症状や感染しないようにはならないという事です。それでも重症化を防げるので打たないより打った方が良いですね?。なお、混合ワクチン接種が結構無敵だとか?インドではDNAワクチン接種を世界初で承認したみたいですね。新たな変異種も防ぐことが出来れば一気にDNAワクチン接種が世界的に進みそうです。

さて、前置きはここまでとして、数珠繋ぎにTweet(リプライ)するPHP言語のコードは意外にも簡単に書けました、なお、[TwitterOAuth](https://github.com/abraham/twitteroauth)というライブラリを使用して呟いています。

![](https://zip358.com/wp-content/uploads/2021/08/SnapCrab_NoName_2021-8-26_10-19-40_No-00.png)作った経緯は数珠繋ぎにする方法などは調べてもヒットしなかったので記載しようと思ったわけです。今回の方法でアファリエイトなどを紹介などや長文のツイートが行えるなどいろいろな用途に使えるかと思います。

※このソースコードはコマンドライン([CUI](https://e-words.jp/w/CUI.html))から叩かないと(実行)、動かない仕様になっています。

```
<?php
require_once("../vendor/autoload.php");
use Abraham\TwitterOAuth\TwitterOAuth;
if ($argv[0]) {
    require_once "./tw-config.php";
    $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
    date_default_timezone_set('Asia/Tokyo');
    $affiliate = json_decode(file_get_contents("./affiliate.json"));
    $id = null;
    foreach ($affiliate->{date("w")} as $key=>$val) {
        $str = $id?array("status"=>$affiliate->{date("w")}[$key]->txt,"in_reply_to_status_id"=>$id):array("status"=>$affiliate->{date("w")}[$key]->txt);
        $res = $connection->post("statuses/update",$str);
        $id = $res->id;
    }
}

```



```
{
    "0": [
        {
            "txt": ""
        },
        {
            "txt": "2"
        },
        {
            "txt": "3"
        }
    ],
    "1": [
        {
            "txt": "1"
        },
        {
            "txt": "2"
        },
        {
            "txt": "3"
        }
    ],
    "2": [
        {
            "txt": "1"
        },
        {
            "txt": "2"
        },
        {
            "txt": "3"
        }
    ],
    "3": [
        {
            "txt": "1"
        },
        {
            "txt": "2"
        },
        {
            "txt": "3"
        }
    ],
    "4": [
        {
            "txt": "1"
        },
        {
            "txt": "2"
        },
        {
            "txt": "3"
        }
    ],
    "5": [
        {
            "txt": "1"
        },
        {
            "txt": "2"
        },
        {
            "txt": "3"
        }
    ],
    "6": [
        {
            "txt": "1"
        },
        {
            "txt": "2"
        },
        {
            "txt": "3"
        }
    ]
}
```



 [ ![](https://zip358.com/wp-content/uploads/2026/01/image-31.png) サイトを分離した話を黙々と書いていきます.

 ](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/wp-content/uploads/2026/01/image-30-300x300.png) 半額セールでアドビ様を延長.

 ](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) 

 [ ![](https://zip358.com/wp-content/uploads/2026/01/image-29.png) 何の前触れもなく変えたのは初めてかも.

 ](https://zip358.com/2026/02/02/%e4%bd%95%e3%81%ae%e5%89%8d%e8%a7%a6%e3%82%8c%e3%82%82%e3%81%aa%e3%81%8f%e5%a4%89%e3%81%88%e3%81%9f%e3%81%ae%e3%81%af%e5%88%9d%e3%82%81%e3%81%a6%e3%81%8b%e3%82%82.html) 

 [ ![](https://zip358.com/wp-content/uploads/2023/01/you-300x300.png) 跳ねたいサイトで跳ねたい

 ](https://zip358.com/2026/02/01/%e8%b7%b3%e3%81%ad%e3%81%9f%e3%81%84%e3%82%b5%e3%82%a4%e3%83%88%e3%81%a7%e8%b7%b3%e3%81%ad%e3%81%9f%e3%81%84.html) 

 [ ![](https://zip358.com/wp-content/uploads/2026/01/image-36.png) 映画、機動戦士ガンダム 閃光のハサウェイ キルケーの魔女

 ](https://zip358.com/2026/01/31/%e6%98%a0%e7%94%bb%e3%80%81%e6%a9%9f%e5%8b%95%e6%88%a6%e5%a3%ab%e3%82%ac%e3%83%b3%e3%83%80%e3%83%a0-%e9%96%83%e5%85%89%e3%81%ae%e3%83%8f%e3%82%b5%e3%82%a6%e3%82%a7%e3%82%a4-%e3%82%ad%e3%83%ab%e3%82%b1.html)