没有显示输出?

时间:2019-03-03 12:32:31

标签: php php-curl

我确实使用以下脚本,但未获得任何输出。甚至没有显示在CURL-ing之前执行的de echo。怎么了?有帮助吗?

<?php 
error_reporting(E_ALL);
ini_set('display_errors',1);
$localfile = (dirname(__FILE__).'/save/zippedfile.zip');
$ftp_host = 'ssh.mysite.com'; /* host */
$ftp_user_name = 'username'; /* username */
$ftp_user_pass = 'password'; /* password */
$url="ftp://$ftp_host/existingmap/";
echo "$url<br>";
$curl_file = curl_file_create($localfile,'zip');
$params = ['file' => $curl_file];
$ch=curl_init();
$fp = fopen($localfile, 'r');
curl_setopt($ch, CURLOPT_URL, "$url".'/zonderslip.zip');
curl_setopt($ch, CURLOPT_VERBOSE,true);
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
curl_setopt($ch, CURLOPT_USERPWD, "$ftp_user_name:$ftp_user_pass");
$result=curl_exec ($ch);
$info = curl_getinfo($ch);
var_dump($info);
curl_close ($ch);
echo $result;
$error_no = curl_errno($ch);
if ($error_no != 0) {
    echo "<br>Final:".curl_error();
    die('File upload error.');
}
echo "<br>done";
?>

即使第一个ECHO也没有显示。 取出CURL_EXEC会显示输出

0 个答案:

没有答案