curl-and-php
Question about options in FORM POST Multipart
Date: Sat, 24 Dec 2005 10:28:17 +0100
Hi, I am all new to CURL, but I am stuck in a FORM POST method,
Multipart enctype , submitting.
I've made my own form somewhere, then submit a file and values to it,
using the command line tool, or a php script, this is working.
But I really can't send anything to the url :
http://imageshack.us/iframe.php
( with requests the file to be a picture )
When I try to submit it in the command line I get NOTHING in return.
Via my php script , I get : "1" instead of the result page.
When you use the page directly, this is working, when you copy the code
to you own webserver, this is still working ( no host filter then )
I guess I must pass other options in my request and many other more to
let CURL act EXACTLY as the original HTTP POST form.
Can someone help me ?
Thank you.
--- My PHP SCRIPT ( working to submit self made POST FORMs ) <?php $url='http://imageshack.us/index.php'; $postData = array(); $postData[ 'fileupload' ] = "@".$fichier; $postData[ 'submit' ] = "upload"; $postData[ 'type' ] = "blank"; $postData[ 'aff' ] = ""; $postData[ 'MAX_FILE_SIZE' ] = "1048576"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url ); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_INFILESIZE, filesize($fichier) ); curl_setopt($ch, CURLOPT_POSTFIELDS, $postData ); $response = curl_exec( $ch ); //echo curl_error($ch); curl_close($ch); echo $response; ?> _______________________________________________ http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-phpReceived on 2005-12-24