dqfxao2898 2017-03-25 19:21
浏览 90

无法从不可读的流中读取

I am trying to download an external file using guzzle. This is the code that I use:

// $url is a URL I receive from Openload's API request
$url = 'https://abvzps.example.com/dl/l/4spxX_-cSO4/The+quick+brown+fox.mp4';
$path = storage_path('app/remote-uploads/test.mp4');

$client = new Client();
$client->get($url, ['sink' => $path]); 

The code works and downloads from localhost just fine, but when I push it to production I receive this error:

[2017-03-25 19:08:06] production.ERROR: RuntimeException: Cannot read from non-readable stream in /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/psr7/src/Stream.php:208
Stack trace:
#0 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php(132): GuzzleHttp\Psr7\Stream->read(120)
#1 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php(105): GuzzleHttp\Exception\RequestException::getResponseBodySummary(Object(GuzzleHttp\Psr7\Response))
#2 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#3 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#4 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)
#5 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#6 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/promises/src/Promise.php(246): GuzzleHttp\Promise\TaskQueue->run(true)
#7 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/promises/src/Promise.php(223): GuzzleHttp\Promise\Promise->invokeWaitFn()
#8 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/promises/src/Promise.php(267): GuzzleHttp\Promise\Promise->waitIfPending()
#9 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/promises/src/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#10 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#11 /var/www/vhosts/clooud.tv/httpdocs/vendor/guzzlehttp/guzzle/src/Client.php(129): GuzzleHttp\Promise\Promise->wait()
...

I am not quite sure how to go about this and would really appreciate any help!

  • 写回答

1条回答 默认 最新

  • dqba94619 2017-03-26 21:06
    关注

    It's hard to say something without the real URL and debugging.

    Just set a breakpoint before the exception and take a look at the response. IMO it should contain an error, but I have no idea, which one exactly.

    评论

报告相同问题?

悬赏问题

  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 基于52单片机的酒精浓度检测系统加继电器和sim800
  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答