curl-and-php
Re: cURL problem
Date: Tue, 22 Jan 2008 22:17:45 -0600 (CST)
I dunno about cURL, but in HTML, you have to have the encoding type
thingie in the FORM tag.
I am guessing there is a corresponding CURLOPT_, though I have no idea
what it is...
On Sun, January 20, 2008 6:40 am, Mad Trax wrote:
> Hello!
> I'm trying to upload a video to putfile.com using CURL, but when I
> cilck the submit button , I'm redirected to the form upload page and
> not to an succesfull page.And the video isn't uploaded either.So
> basicaly the script doesn't upload the video or any values, it's only
> redirecting me to the upload form :(
> Here is the code :
>
>
> $postdata=array();
> $postdata['username']="$user \n";
> $postdata['imagefile']="@$video";
> $postdata['txtTitle']="$title \n";
> $postdata['category']="$category \n";
> $postdata['SubmitImage']="Upload%20Media \n";
>
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_POST, TRUE);
> curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE
> 5.01; Windows NT 5.0)");
> curl_setopt($ch, CURLOPT_COOKIEJAR, "mycookie.txt"); //initiates
> cookie file if needed
> curl_setopt($ch, CURLOPT_COOKIEFILE, "mycookie.txt"); // Uses cookies
> from previous session if exist
> curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
> curl_setopt($ch, CURLOPT_HEADER, TRUE);
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION,TRUE); // follow redirects
> recursively
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
> curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
> curl_setopt($ch, CURLOPT_URL,"http://www.putfile.com/mediaupload");
> curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
> $buf=curl_exec ($ch);
> $error_no = curl_errno($ch);
> curl_close ($ch);
>
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
> Try it now._______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
>
-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? _______________________________________________ http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-phpReceived on 2008-01-23