curl-and-php
PHP cURL : File upload is sucessful in Windows but not in UNIX.
Date: Mon, 3 Dec 2007 23:43:59 +0000
Hi Everyone,
I am not able to Upload the file to remote server in UNIX environment. The same PHP-cURL script is working fine in Windows environment.
I have attached my PHP script and logs with this email.
First 4 screens traverse including login is working fine in both environment.
Only uploading part is not working in UNIX.
I am not sure if I am missing something. Steps of upload are written below.
Version of PHP : 5.1.4
Version of cURL: 7.15
$STEPSEVENURL = 'https:\\www.PPPP.com\F\UplFile.aspx';
$reffer = 'https:\\www.PPPP.com\F\UplFile.aspx';
$postData = array();
$postData[ '__VIEWSTATE' ] = $startposition_6;
$postData[ 'Uplod' ] = $uploadFile;
$postData[ 'Submit' ] = 'Submit';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$STEPSEVENURL);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
\\output to file
$fp = fopen ($step6file, 'w');
curl_setopt ($ch , CURLOPT_FILE, $fp);
\\execute
$result =curl_exec ($ch );
\\ print errors
print_r(curl_getinfo($ch));
echo '\n\ncURL error number:' .curl_errno($ch);
echo '\n\ncURL error:' . curl_error($ch);
\\close resources
curl_close ($ch );
fclose ($fp);
Your input will be very appreciated.
Thanks & Regards,
SMD
_________________________________________________________________
Tried the new MSN Messenger? It’s cool! Download now.
http://messenger.msn.com/Download/Default.aspx?mkt=en-in
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
- text/plain attachment: Unix_Echo.log
- text/plain attachment: Win_Echo.log
- text/plain attachment: Unix_log_1.txt
- text/plain attachment: Win_log_1.txt
- application/octet-stream attachment: LibCurl-PHP.php