Php Twitter:OpenSSL\u read:Connection reset by peer,errno 104
Twitter:OpenSSL\u read:Connection reset by peer,errno 104 Twitter:操作在5000毫秒后以0字节超时 收到 这是我在尝试将视频文件分块上传到Twitter时(随机)遇到的两个错误Php Twitter:OpenSSL\u read:Connection reset by peer,errno 104,php,twitter,Php,Twitter,Twitter:OpenSSL\u read:Connection reset by peer,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 f
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)
我的代码与此非常相似:我正在使用库
通过调试,我知道此函数中会抛出错误
报告说:
“媒体”正在上载的原始二进制文件内容。一定是
已解决 我所要做的就是更改我使用的库,它立即开始工作,没有任何重大更改
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++;
}
}