
This is a discussion on [Tutorial] Curl Login within the PHP forums, part of the Program Your Site category; you need to save it as .php and you upload it on your server....
| |||||||
| 63 Online | Register | Projects | Products | Members List | Calendar | Today's Posts | Search |
| |||
| Hey, First, just want to say thanks a million for posting this tutorial. Your site singlehandedly got me going with this stuff and I almost have some really cool/useful internal tools set up. After about 14 hours straight of workin' on this I've run into a problem. Basically, I have a website where I place orders very very regularly. I have to log in, and then check out on their site. I am trying to do this using CURL and with your guidance I have been able to log in and get to the final stages of checkout. I'm running into a problem on one of the last pages where I have to submit a new "ship to" address. I'm trying to do this with curl and for some reason it doesn't want to work. I have my $data 100% correct I know because I ended up literally cutting and pasting it from firefox to be extra safe (I can switch to dynamic stuff later but for testing I'm doing it this way). The message I get is: Quote:
What is the basic process for logging in to a site with curl and then submitting more data in forms that are only accessible to a logged in user? And also, is there an easier way to error check? Needless to say, the message I'm getting isn't very descriptive. I go to a page like "secure/shipto/change_shipto.asp" and then have to click a link that takes me to secure/shipto/add.asp?url=change_shipto.asp. I've submitted this form manually and used the firefox extension you mention to check the headers and I am sending all the right data now using curl. HTML Code: < form method="post" action="add1.asp" name="new_account1"> <input type=hidden name="url" value="change_shipto.asp"> <input type=hidden name="acct" value="0020102"> <input type="submit" name="B1" value="Cancel" class="valor_www_button"> <input type="submit" name="B1" value="Add Ship To"> </form> There are some input fields within the forum that I had to cut out because they are so long, but that should give the gist of it. I know I haven't been as clear as I should have, but it's kind of hard when the site actually requires a log in so I can't even show the URL here. Any help you can provide would be greatly appreciated. I get the problem when submitting the form above. |
| |||
| Quote:
you can use the login function for that too. the login function doesn't really login it basically sends data to the url, It can be used for many other things. |
| |||
| Thank you Chad for such a useful functions and support for beginners. I have 2 main problems now. 1. The login doesnt work. I was trying to detect the error, and I think it is because the cookie file keeps being empty. I have the test files on a XAMPP directory on my desktop PC, with WinXP SP2, on a NTFS partition. I have Administrative privileges. As you will see, I open 2 files, one for error reporting and the other one for cookies. The error reporting file is being opened without problems by curl, because I give it a handle to an open file. However for cookies I give a filename, so I dont know if curl can write to that file. 2. The images on the target site have relative paths, so they wont show on my browser via curl. I think this is not so difficult to fix, but I am new to curl, so please enlighten me where should I look for a solution. Besides, I would like to know if it is possible to give curl a variable instead of a filename for cookie options. Because I would like to redirect the cookies to the end user, instead of storing them on the server. Something like this: SITE ---- [login_cookie]----> PHP/CURL setrawcookie() ---- [login_cookie] ----> END USER Thank you very much again, I would appreciate a lot if you can give me some advice. Roman. Here is my test code: PHP Code: Quote:
Last edited by r0manoff; 07-13-2007 at 03:26 PM. |
| |||
| Thanks! Hi Chad, I just wanted to thank you for the very informative cUrl tutorial. I've been searching for hours on how to get cUrl to work with my site to no avail. That is until I stumbled upon your tutorial. Thanks so much. It works perfectly. Do you have some kind of RSS feed where I can get regular updates from you? |
| |||
| Quote:
Thanks allot!!! It was very helpful. Just what I needed... Now, all I need is a run through of how to go about parsing and/or stripping out things I don't need, as well as have the end result display in a nice, neat designed layout on the page I will view it on... Any suggestions? Maybe another wonderful tutorial? ;) Thanks again, Chris |
| |||
| Quote:
|
| |||
| Quote:
I sent a prvt message or two your way about maybe getting a little bit of help with the end result of what I have after I've successfully logged in ans pulled the data I need. What I need out of the source code is not too terribly much, however, I was looking at having it before the beginning of next week. Let me know if you would be interested.. Thanks again, Chris |
![]() |
| |