Upload images to remote servers. PHP

血红的双手。 提交于 2019-12-05 23:18:23

You could use ftp. PHP has fairly easy way to do this. Check this link.

http://www.php.net/manual/en/book.ftp.php

If you already have HTTP servers runing on the other servers, use cURL. Usage:

  1. Call curl_init
  2. Call curl_setopt
  3. Call curl_exec

The HTTP request can be configured using curl_setopt. Especially of interest are the options CURLOPT_URL, CURLOPT_POST and CURLOPT_POSTFIELDS.

You can use Zend_Http Client to upload the files to other servers per HTTP the same way an HTML Upload Form would do it. You can find all the information you need here in the Section "File Uploads": http://www.zendframework.com/manual/en/zend.http.client.advanced.html

For getting started you should read also this:

http://www.zendframework.com/manual/en/zend.http.client.html

Basically the code you need is:

require_once('Zend/Http/Client.php');
$client = new Zend_Http_Client("http://serverurl/path");
$client->setFileUpload(...);
$client->request();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!