|
Posted by R. Rajesh Jeba Anbiah on 05/17/06 11:14
HC wrote:
> OK, last time I posted, I must have been totally unclear :) Hopefully
> this clears things up:
>
> I wrote the following script that uses Curl to mimic submitting a form
> over SSL with <input type='file'>. It works well, but for security
> reasons, I would like to not have to write the necessary data to a
> temporary file. If anyone could point me in the right direction, that
> would be great.
<snip>
I guess, you need to chuck CURLOPT_POST and CURLOPT_POSTFIELDS; and
hence add the file contents and other form contents explicitly via the
(custom) HTTP headers using:
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header_array);
To see, how to form the header manually, look at the Example section
(6) at <http://www.faqs.org/rfcs/rfc1867.html>
In other words, you need to mimic the headers of browser as long at
you're getting it done. You may also enable verbose logging for easy
debugging:
$fp_err = fopen('verbose_file.txt', 'ab+');
fwrite($fp_err, date('Y-m-d H:i:s')."\n\n"); //add timestamp to the
verbose log
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_STDERR, $fp_err);
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
Navigation:
[Reply to this message]
|