Jump to content

ntesla123

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by ntesla123

  1. I'm trying use curl to login into a page that sets cookies using javascript, but curl doesn't register the cookies. Is there another way of getting the javascript cookies?
  2. I'm trying to log into a site like this one. http://www.celebritymoviearchive.com/members/ It uses a get statement with Authorization: Basic bmxwdGVjaDFAaG90bWFpbC5jb206eGVobW51NGU= This is the data that's sent: GET /members/ HTTP/1.1 Host: www.celebritymoviearchive.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.16) Gecko/20110323 Ubuntu/10.04 (lucid) Firefox/3.6.16 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Authorization: Basic bmxwdGVjaDFAaG90bWFpbC5jb206eGVobW51NGU= HTTP/1.1 200 OK Date: Wed, 06 Apr 2011 22:07:35 GMT Server: Apache/2.2 X-Powered-By: PHP/5.3.6 Content-Encoding: gzip Vary: Accept-Encoding Content-Length: 2608 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html
  3. I want to make a curl login script to a website where I have an account. When I try to use httpheaders to find out which variables are posted when I log in, I can't see any post statement. How do I log in to sites like that?
  4. I'm trying to login to a vBulletin forum using a captcha login. I am, however, not able to download the captcha image. This is the result I get when I try to get the captcha: So how do I get the captcha image? This is my current login code: <?php $user='username'; $pass='password'; $md5Pass = md5($pass); $data = "do=login&vb_login_md5password=$md5Pass&vb_login_md5password_utf=$md5Pass&vb_login_username=$user&cookieuser=1"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, "http://www.****.com/login.php?do=login"); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt ($ch, CURLOPT_TIMEOUT, '10'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch,CURLOPT_POSTFIELDS,$data); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $store = curl_exec ($ch); curl_close($ch); echo $store; ?> Maybe the site looks for a cookie and only shows the captcha if it finds the cookie file?
  5. I am trying to use curl to login to a website and get the login cookie. After I try to post, however, I get a 302. Does anyone know how to log into a page like this? Maybe there's a tutorial or something. This what firefox sends: http://oron.com/ POST / HTTP/1.1 Host: oron.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Referer: http://oron.com/login.html Cookie: login=username; xfss=; per_page_files=50 Content-Type: application/x-www-form-urlencoded Content-Length: 56 login=username&password=password&op=login&redirect=&rand= HTTP/1.1 302 Moved Server: nginx/0.8.50 Date: Tue, 22 Mar 2011 00:56:34 GMT Content-Type: text/plain; charset=UTF-8 Connection: keep-alive Set-Cookie: login=username; domain=.oron.com; path=/; expires=Mon, 20-Jun-2011 00:56:34 GMT Set-Cookie: xfss=sijw0iyu3evs3f13; domain=.oron.com; path=/; expires=Mon, 20-Jun-2011 00:56:34 GMT Location: http://oron.com/?op=my_account Content-Length: 0 ---------------------------------------------------------- http://oron.com/?op=my_account GET /?op=my_account HTTP/1.1 Host: oron.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Ubuntu/10.04 (lucid) Firefox/3.6.15 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Referer: http://oron.com/login.html Cookie: login=username; xfss=sijw0iyu3evs3f13; per_page_files=50 HTTP/1.1 200 OK Server: nginx/0.8.50 Date: Tue, 22 Mar 2011 00:56:35 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Expires: Mon, 21 Mar 2011 00:56:35 GMT Content-Encoding: gzip
  6. I have made this script to upload to an ftp server. How do I get the script to try to restart the upload if it fails? (if if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) returns false) <?php $file = 'file.wmv'; $remote_file = 'file.wmv'; // set up basic connection $conn_id = ftp_connect('ftp.eu.filesonic.com'); $ftp_user_name='username'; $ftp_user_pass='password'; // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // upload a file if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { echo "successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } // close the connection ftp_close($conn_id); ?>
  7. OK, thanks. Now I have done it, but it still doesn't work.
  8. This is my attempt to make an upload script to upload images to my own website. <?php $ch = curl_init("http://*******.com/imgupload.html"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array('file'=>"@/home/user/mypic.jpg", 'submit'=>'Submit')); $postResult = curl_exec($ch); curl_close($ch); print "$postResult"; ?> The working upload form I'm trying to post to: <html> <body> <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> Why doesn't this work?
  9. How do I use curl to upload an image to this form? <?php //define a maxim size for the uploaded images in Kb define ("MAX_SIZE","100"); //This function reads the extension of the file. It is used to determine if the file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } //This variable is used as a flag. The value is initialized with 0 (meaning no error found) //and it will be changed to 1 if an errro occures. //If the error occures the file will not be uploaded. $errors=0; //checks if the form has been submitted if(isset($_POST['Submit'])) { //reads the name of the file the user submitted for uploading $image=$_FILES['image']['name']; //if it is not empty if ($image) { //get the original name of the file from the clients machine $filename = stripslashes($_FILES['image']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); //if it is not a known extension, we will suppose it is an error and will not upload the file, //otherwise we will do more tests if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { //print error message echo '<h1>Unknown extension!</h1>'; $errors=1; } else { //get the size of the image in bytes //$_FILES['image']['tmp_name'] is the temporary filename of the file //in which the uploaded file was stored on the server $size=filesize($_FILES['image']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($size > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name=time().'.'.$extension; //the new name will be containing the full path where will be stored (images folder) $newname="images/".$image_name; //we verify if the image has been uploaded, and print error instead $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; }}}} //If no errors registred, print the success message if(isset($_POST['Submit']) && !$errors) { echo "<h1>File Uploaded Successfully! Try again!</h1>"; } ?> <!--next comes the form, you must set the enctype to "multipart/frm-data" and use an input type "file" --> <form name="newad" method="post" enctype="multipart/form-data" action=""> <table> <tr><td><input type="file" name="image"></td></tr> <tr><td><input name="Submit" type="submit" value="upload"></td></tr> </table> </form>
  10. actually, a lot of proxies don't support http post, and the ones that I have found that do, aren't possible to use with curl.
  11. I need a proxy that would enable me to use curl with another ip address. How do I find a paid proxy server that supports curl?
  12. Do you know how I can login to http://www.filesonic.com/user/login ? I tried to look at live httpheaders to see what is being sent, but it's blank, and it's not possible to view it.
  13. Is it possible to make curl set the expiration date on cookies? I don't see that the expiration date has been set using the ordinary settings, and I have a problem with a forum using the expiration date to see if the session has expired.
  14. I'm trying to post to a (SMF) simplemachines 2.0 forum using curl. I have logged in and I have tried sending all the fields, but when I try to post, I receive this message: "The following error or errors occurred while posting this message: Your session timed out while posting. Please try to re-submit your message." Do any of you know why this happens? Is the problem that when I visit the posting url, they give me a cookie that expires if I leave the posting url? I don't think the form is invalid, it looks like it has to do with the session. People at the simplemachines forum can have this problem when they try to post the ordinary way, but that is because of an inactivity period. Can my problem be because of a cookie?
  15. How do I post to a forum where the Submit button doesn't have a name? I haven't found anything like post=Post or post=Submit or anything of that sort. I have used curl in several different forums, but I have never seen anything like this. I'm sure it's simple though. <input type="submit" value="Post" tabindex="3" onclick="return submitThisOnce(this);" accesskey="s" class="button_submit" /> This forum also has a hidden variable where the name is never the same, but generated: <input type="hidden" name="ee40576" value="6d412be2ae8f344b177ad5b8ef2575d2" /> I'm pretty sure I can just send ee40576=6d412be2ae8f344b177ad5b8ef2575d2 though. The forum is an smf forum, and I have been able to log in. I have also posted at other smf forums similar to this, only there the submit button had a name.
  16. I just managed to login to a forum using curl, but then I found out I had to extract the session id before I could start posting. The session id is in a string like this: sesc=b97b74351fde8dfbac7391af1f054de9 How do I extract the value b97b74351fde8dfbac7391af1f054de9 if I know that it comes righ behind "sesc=". I think I am supposed to use strpos, but I don't know.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.