将图像从我的服务器上传到受密码保护的网站
我正在建立一个网站,以帮助组织我的业务。但我遇到了障碍。我们的网站是用 PHP 和 MySQL 编码的,就目前而言,我们的承包商可以将图像上传到我们的网站,我们的网站重新标记图片并将它们与工作订单相关联(以便以后能够在需要时进行搜索),然后存储图像在我们的数据库中。
然而,我想做的是将图像上传到我们供应商网站上各自的工作订单中。我已经联系了我们的供应商,他们不允许我们直接通过 POST 命令访问他们的服务器。所以我很好奇是否有办法仍然将我们的图像从我们的网站上传到我们供应商的网站。他们的网站受密码保护。在他们的网站上,我找到与工作订单关联的工作订单并手动上传图像,但我想找到一种自动执行此操作的方法。他们的站点和我们的站点之间的工单编号是相同的。有什么想法吗?
新信息
我在下面留下的评论只是指出我必须手动单击上传按钮,选择要上传的照片,然后单击“上传”才能上传图像。 FTP 也不被允许。
I'm in the process of building a site that will help to organize my business. But I'm at a roadblock. Our site is coded in PHP and MySQL and as it currently stands, our contractors can upload images to our site, our site relabels the pictures and associates them with a work order (for ability to search later, if needed), then stores the images in our database.
However, what I want to do is have the images uploaded to their respective work order on our supplier's site. I have contacted our supplier and they will not allow us to access their server directly through the POST commands. So I'm curious if there is a way to still have our images uploaded from our site to our supplier's site. Their site is password protected. On their site, I find the work order associated to the work order and manually upload the images, but I'd like to find a way to do this automatically. The work order numbers between their site and ours are the same. Any ideas?
New Info
The comment I left below just states that I have to actually manually click the upload button, choose which photos to upload, then click "upload" to have the images uploaded. FTP is not allowed either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果“手动”指的是登录后全部由 www 表示,则可以使用 CURL 模拟其网站的登录会话(访问登录页面以获取会话 cookie,然后使用该会话 cookie 发布登录数据,然后使用授权的会话 cookie作为授权用户可以从他们的网站获取/发布任何您想要的内容)。使用 Firebug 跟踪发出的请求以及从/到其网站传递的数据。
由于使用 CURL 可能很痛苦(它的语法远非用户友好),您可以尝试从 Zend Framework 中获取并提取 Zend_Http,这样您将拥有非常简单的语法,如果您的服务器上没有 CURL,它甚至可以在没有 CURL 的情况下工作。
If by "manually" you mean all by www after logging in, you can use CURL to simulate login session to their website (access login page to obtain session cookie, then post login data with that session cookie, and then with authorized session cookie you can GET/POST whatever you want from their website as authorized user). Use Firebug to track what requests are made and what data are passed from/to their website.
Since using CURL can be painfull (it's syntax is far from user friendly) you can try grab and extract Zend_Http from Zend Framework so you will have very easy syntax and it even work without CURL if you haven't it on your servers.
如果他们授予您 ftp 访问权限,您可以通过编程方式将图像传输给他们
或者如果他们有某种 api 公开方法来上传图像
if they will grant you ftp access you can programatically transfer the images to them that way
or if they have some sort of api exposing methods to upload images
“手动上传”是指通过 FTP 上传吗?您可以使用 PHP 来完成。 这里是文档。
出于安全原因,我建议您在客户端服务器上创建一个只能访问图像目录的 FTP 用户,并通过该帐户进行连接。
By "manually upload", you mean via FTP? You can do it with PHP. Here is the documentation.
For security reasons, I suggest you create an FTP user on your client's server which only has access to the images directory, and connect trough that account.