Twitter:OpenSSL SSL_read:连接被对等方重置,errno 104
Twitter: OpenSSL SSL_read: Connection reset by peer, errno 104
Twitter: OpenSSL SSL_read: Connection reset by peer, errno 104
Twitter: Operation timed out after 5000 milliseconds with 0 bytes
received
这是我在尝试将视频文件分块上传到 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 and I'm using the 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++;
}
}
我通过调试知道这个函数抛出了错误。
"media" The raw binary file content being uploaded. It must be
<= 5 MB, and cannot be used with media_data.
"media_data" The base64-encoded chunk of media file. It must be
<= 5 MB and cannot be used with media. Use raw binary (media
parameter) when possible.
我尝试了两种选择,但都没有成功。我错过了什么?为什么我不能上传更大的文件?
已解决.
我所要做的就是将我使用的库更改为 https://github.com/jublo/codebird-php,它立即开始工作,无需任何重大更改。
Twitter: OpenSSL SSL_read: Connection reset by peer, errno 104
Twitter: Operation timed out after 5000 milliseconds with 0 bytes received
这是我在尝试将视频文件分块上传到 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 and I'm using the 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++;
}
}
我通过调试知道这个函数抛出了错误。
"media" The raw binary file content being uploaded. It must be <= 5 MB, and cannot be used with media_data.
"media_data" The base64-encoded chunk of media file. It must be <= 5 MB and cannot be used with media. Use raw binary (media parameter) when possible.
我尝试了两种选择,但都没有成功。我错过了什么?为什么我不能上传更大的文件?
已解决.
我所要做的就是将我使用的库更改为 https://github.com/jublo/codebird-php,它立即开始工作,无需任何重大更改。