【问题标题】:Twitter: OpenSSL SSL_read: Connection reset by peer, errno 104Twitter:OpenSSL SSL_read:对等方重置连接,errno 104
【发布时间】:2021-08-27 15:20:14
【问题描述】:

Twitter:OpenSSL SSL_read:对等方重置连接,errno 104

Twitter:操作在 5000 毫秒后超时,0 字节 收到了

这是我在尝试将视频文件分块上传到 Twitter 时(随机)遇到的两个错误。

1.5MB file = Most of the times uploads, sometimes gives error
10MB file = Always gives error (one of the above, randomly)
20MB file = Always gives error (one of the above, randomly)

我的代码与下面的代码非常相似:Upload Twitter video error (PHP). API response: Segments do not add up to provided total file size,我正在使用TwitterOAuth 库。

function append($mediaId, $fileUrl)
{
    $segmentIndex = 0;

    $handle = fopen($fileUrl, 'r');

    while (!feof($handle)) 
    {
        $chunk = fread($handle, 4 * 1024 * 1024); // 4mb 

        $params = ['command' => 'APPEND', 'media_id' => $mediaId, 'media_data' => base64_encode($chunk), 'segment_index' => $segmentIndex];
        $this->tw->uploadCustom('media/upload', $params);

        $segmentIndex++;
    }
}

我通过调试知道这个函数中抛出了错误。

documentation 说:

"media" 上传的原始二进制文件内容。一定是

"media_data" base64 编码的媒体文件块。一定是

我尝试了这两个选项,但都没有成功。我错过了什么?为什么我不能上传更大的文件?

【问题讨论】:

    标签: php twitter


    【解决方案1】:

    已解决

    我所要做的就是将我正在使用的库更改为 https://github.com/jublo/codebird-php,它立即开始工作而没有任何重大更改。

    【讨论】:

      猜你喜欢
      • 2016-03-03
      • 2016-10-10
      • 2018-05-22
      • 2014-01-04
      • 1970-01-01
      • 1970-01-01
      • 2023-01-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多