Uploading pictures to sm.ms is suspected to be blocked ip.

use php to upload pictures to https://sm.ms using guzzleHttp. At first, it can be uploaded, but then I feel that ip is blocked, and then I use my phone to open a hot spot, and then I can"t do it again. After a while, I can"t do it again. Why do you want to block upload api when you open it? I didn"t upload abnormal pictures either.
sm.ms document: https://sm.ms/doc/

Php
May.22,2021

No one answers for yourself, because after a while I think I probably know the reason, because its server is abroad, as long as it is a foreign server, this problem may occur because is well known . Just add an agent option yourself. The following is a sample code

.
$GuzzleConfig = [
    'base_uri' => $this->baseUri,
    'timeout'  => 10.0,
];
if($this->proxy){
    $GuzzleConfig['proxy'] = $this->proxy;
}
//GuzzleHttp
$client = new Client($GuzzleConfig);
//upload?ssl=1
//post file to https://sm.ms
$response = $client->request('POST', 'upload?ssl=1', [
    'multipart' => [
        [
            'name'     => 'smfile',
            'contents' => fopen($uploadFilePath, 'r')
        ],
    ]
]);

$string = $response->getBody()->getContents();
The value of

$this- > proxy is 127.0.0.1 code 1086 . 1086 is the local http proxy port (your scientific Internet tools such as ss http port)

Menu