seres Posted May 9, 2011 Share Posted May 9, 2011 hello, im trying to make an upload to megaupload using curl, i still dont understand much about curl but for what i have found i get as close as this scrips, but i dont get the curl.txt to get the uploaded route, here are the scrips: $_UploadFilePath = "C:\Users\luis\Desktop\imagenes diseño\blue.jpg" $message = "lets try" ;this are my tries to make it work but cant find the correct one ;~ Send ('"' & @ScriptDir & "\curl\curl.exe" & '"' & " -F file=@" & '"' & $_UploadFilePath & '"' & " -F message=" & '"' & $message & '"' & " -H Expect: -o curl.txt --location-trusted --url " & '"http://www.megaupload.com/UPLOAD_IDENTIFIER=$id&sessionid=$id&s=13"') Send ('"' & @ScriptDir & "\curl\curl.exe'" & " -s -A Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" & '"' & " -F file=@" & '"' & $_UploadFilePath & '"' & " -F message=" & '"' & $message & '"' & " -H Expect: -o curl.txt --location-trusted -L " & '"http://www.megaupload.com/UPLOAD_IDENTIFIER=$id&sessionid=$id&s=13"') ;~ Send (@ScriptDir & '\curl\curl.exe -F fileupload=@"' & $_UploadFilePath & '" -H Expect: -o curl.txt --location-trusted --url "http://www.megaupload.com"') ;~ Send (@ScriptDir & '\curl\curl.exe -F fileupload=@"' & $_UploadFilePath & '" -H Expect: -o curl.txt --location-trusted --url "http://www.megaupload.com"') if someone can help me i have been reading and tring curl for almost a week i already got desperate thanks Link to comment Share on other sites More sharing options...
hannes08 Posted May 9, 2011 Share Posted May 9, 2011 Hi seres, can't you use Run() instead of Send()? Does it give you any error messages? Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
seres Posted May 9, 2011 Author Share Posted May 9, 2011 (edited) Hi seres,can't you use Run() instead of Send()? Does it give you any error messages?yes i had used run() before ;~ Run (@ScriptDir & '\curl\curl.exe -F fileupload=@"' & $_UploadFilePath & '" -H Expect: -o curl.txt --location-trusted --url "http://www.megaupload.com"')but it shows to fast the cmd then it closes thats why im using send to see what does it shows and it will not close because i opened the cmd manuallyonce the program sends to cmd i correct the errors like missing ", and it really runs it but my problem is that im not getting the curl.txt with the returned information Edited May 10, 2011 by seres Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 10, 2011 Share Posted May 10, 2011 (edited) Try this: $sCurl = @ScriptDir & '\curl\curl.exe' $sParam = '-F fileupload=@"' & $_UploadFilePath & '" -H Expect: -o curl.txt --location-trusted --url "http://www.megaupload.com"' $iPID = Run(@ComSpec & '/k "' & $sCurl & '" ' & $sParam) Running @ComSpec with the "/k" switch will leave the console open after the command completes. P.S. See StdOutRead() in the help file. You can add the $STDOUT_CHILD parameter to Run() and read the output text to your script with StdOutRead(). Edited May 10, 2011 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
seres Posted May 11, 2011 Author Share Posted May 11, 2011 (edited) Try this: $sCurl = @ScriptDir & '\curl\curl.exe' $sParam = '-F fileupload=@"' & $_UploadFilePath & '" -H Expect: -o curl.txt --location-trusted --url "http://www.megaupload.com"' $iPID = Run(@ComSpec & '/k "' & $sCurl & '" ' & $sParam) Running @ComSpec with the "/k" switch will leave the console open after the command completes. P.S. See StdOutRead() in the help file. You can add the $STDOUT_CHILD parameter to Run() and read the output text to your script with StdOutRead(). hello, i tried this, but it doesnt show the cmd and it doesnt return me the file curl.txt $_UploadFilePath = "C:\Users\luis\Desktop\imagenes diseño\blue.jpg" $sCurl = @ScriptDir & '\curl\curl.exe' $sParam = '-F fileupload=@"' & $_UploadFilePath & '" -H Expect: -o curl.txt --location-trusted --url "http://www.megaupload.com"' Run(@ComSpec & '/k "' & $sCurl & '" ' & $sParam) i tried this too but i got blank messageboxs $_UploadFilePath = "C:\Users\luis\Desktop\imagenes diseño\blue.jpg" $sCurl = @ScriptDir & '\curl\curl.exe' $sParam = '-F fileupload=@"' & $_UploadFilePath & '" -H Expect: -o curl.txt --location-trusted --url "http://www.megaupload.com"' $iPID = Run(@ComSpec & '/k "' & $sCurl & '" ' & $sParam, "" , @SW_HIDE , $STDOUT_CHILD) $line = StdoutRead($iPID) MsgBox(0, "STDOUT read:", $line) $line = StderrRead($iPID) MsgBox(0, "STDERR read:", $line) Edited May 11, 2011 by seres Link to comment Share on other sites More sharing options...
wakillon Posted May 12, 2011 Share Posted May 12, 2011 I have tried many solutions, but unsuccsessfully...#include <Constants.au3> $_UploadFilePath = "C:\Users\luis\Desktop\imagenes diseño\blue.jpg" $sCurl = @TempDir & '\curl.exe' $sParam = '-F fileupload=@"' & $_UploadFilePath & '" -H Expect: -o curl.txt --location-trusted --url "http://www.megaupload.com"' $_Run = @ComSpec & '/k "' & $sCurl & '" ' & $sParam ConsoleWrite ( '--------- $_Run : ' & $_Run & @Crlf ) $_Pid = Run ( $_Run, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD ) Dim $_StderrRead='', $_StdoutRead='' While ProcessExists ( $_Pid ) $_StderrRead = StderrRead ( $_Pid ) If Not @error And $_StderrRead <> '' Then _ ConsoleWrite ( "STDERR read : " & $_StderrRead & @Crlf ) $_StdoutRead = StdoutRead ( $_Pid ) If Not @error And $_StdoutRead <> '' Then _ ConsoleWrite ( "STDOUT read : " & $_StdoutRead & @Crlf ) WendIn any way it return nothing :no error, no output or no txt output...Try another Uploader like YousenditThere is a new Developer API now available ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
seres Posted May 13, 2011 Author Share Posted May 13, 2011 I have tried many solutions, but unsuccsessfully... #include <Constants.au3> $_UploadFilePath = "C:\Users\luis\Desktop\imagenes diseño\blue.jpg" $sCurl = @TempDir & '\curl.exe' $sParam = '-F fileupload=@"' & $_UploadFilePath & '" -H Expect: -o curl.txt --location-trusted --url "http://www.megaupload.com"' $_Run = @ComSpec & '/k "' & $sCurl & '" ' & $sParam ConsoleWrite ( '--------- $_Run : ' & $_Run & @Crlf ) $_Pid = Run ( $_Run, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD ) Dim $_StderrRead='', $_StdoutRead='' While ProcessExists ( $_Pid ) $_StderrRead = StderrRead ( $_Pid ) If Not @error And $_StderrRead <> '' Then _ ConsoleWrite ( "STDERR read : " & $_StderrRead & @Crlf ) $_StdoutRead = StdoutRead ( $_Pid ) If Not @error And $_StdoutRead <> '' Then _ ConsoleWrite ( "STDOUT read : " & $_StdoutRead & @Crlf ) Wend In any way it return nothing : no error, no output or no txt output... Try another Uploader like Yousendit There is a new Developer API now available ! do you know another anyway, in which i can use autoit? well, thankyou very much for your time and for trying to help me do you know Link to comment Share on other sites More sharing options...
seres Posted May 13, 2011 Author Share Posted May 13, 2011 (edited) hello, i found this its old and i think is for linux i dont know if it can be ported to windows? nueva version de mi script con user y password usando las cookies 142fc496eac1104b24ae30fdcb1cffa1.12724428403version anterior http://www.taringa.net/posts/linux/3798853/subir-a-Megaupload-desde-bash-con-curl.html #!/bin/bash referer="http://www.megaupload.com/?c=login" pag=`curl -s -e $referer -c cookiestmp.txt -F login='1' -F redir='1' -F username='USERNAME' -F password='PASSWORD' -L http://www.megaupload.com/?c=login` pag=`curl -s -b cookiestmp.txt http://www.megaupload.com | grep '<FORM' | cut -f8 -d"` url=`echo $pag | cut -f1 -d?` id=`echo $pag | cut -f2 -d? | cut -f2 -d=` download=`curl -s -b cookiestmp.txt -A 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)' -F file=@$1 -F message='bashupload' -L $url?"UPLOAD_IDENTIFIER=$id&sessionid=$id&s=13"` echo $download | cut -f6 -d' cambiar USERNAME y PASSWORD copiar y pegar en un archivo nuevo,llamado p ej . megaupload luego chmod +x megaupload para usarlo ./megaupload archivo a subir devuelve el link de descarga Edited May 14, 2011 by seres Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now