note 46976 added to function.curl-exec

From: Date: Fri, 29 Oct 2004 06:29:17 +0000
Subject: note 46976 added to function.curl-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-79300@lists.php.net to get a copy of this message
With php 4.3.9 or higher,you can upload file to ftp server on win32 system <?php function curl_upload($src) { $fn = basename($src); $dest = "ftp://user:passwd@server.com/incoming/$fn"; $ch = curl_init(); $fp = fopen($src,"r"); curl_setopt($ch, CURLOPT_UPLOAD, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 300); curl_setopt($ch, CURLE_OPERATION_TIMEOUTED, 300); curl_setopt($ch, CURLOPT_URL, $dest); curl_setopt($ch, CURLOPT_INFILE, $fp); curl_setopt($ch, CURLOPT_INFILESIZE, filesize($src)); curl_exec($ch); fclose ($fp); $errorMsg = ''; $errorMsg = curl_error($ch); $errorNumber = curl_errno($ch); curl_close($ch); return $errorNumber; } ?> lower version php (I tried on php 4.3.3) on win32 can't do this and may cause php crash even you use CURLOPT_READFUNCTION. ---- Manual Page -- http://www.php.net/manual/en/function.curl-exec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46976 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46976&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46976&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46976&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46976&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46976&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46976&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46976&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#79300) next »