简体   繁体   English

从url2png获取屏幕截图并保存到FTP

[英]Get screenshot from url2png and save to FTP

I am using url2png to get screenshots from pages. 我正在使用url2png从页面获取屏幕截图。 However, instead of asking the image every time, I want to save it onto an external server via FTP. 但是,我不想每次都询问图像,而是想通过FTP将其保存到外部服务器上。

My first approach was to use: 我的第一种方法是使用:

$image = fopen($src,"r");

And then an ftp_fput. 然后是ftp_fput。 But as url2png may take about 5 secs to get the screenshot, the ftp_fput uploads an empty file. 但是由于url2png可能需要大约5秒钟来获取屏幕截图,因此ftp_fput上传了一个空文件。

Do I need to save the file locally first? 我需要先在本地保存文件吗? or is there a workaround? 还是有解决方法?

Thanks! 谢谢!

Found a solution using this question: Using file_get_contents and ftp_put 使用以下问题找到了解决方案: 使用file_get_contents和ftp_put

$fp = fopen('php://temp', 'r+');
fputs($fp, file_get_contents($src));
rewind($fp);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM