sug15 Posted February 21, 2009 Share Posted February 21, 2009 Hey, I need to get the results of a page with curl without submitting the page, because every time the page submits with curl or refreshes with a borwser, a value that I need to submit changes. I was wondering if there was any way to load the page with curl and just get the results, then submit a form later on that submits some data parsed for the page loaded. Basically load data from the page, do something, then submit a form but only using curl_exec once. Quote Link to comment Share on other sites More sharing options...
sug15 Posted February 21, 2009 Author Share Posted February 21, 2009 Bump. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted February 21, 2009 Share Posted February 21, 2009 If you need to grab some data from the page before you can submit it, then it's obviously going to take two requests. It's not possible with one. How does this work if you do it manually? I think we might need more information. Quote Link to comment Share on other sites More sharing options...
sug15 Posted February 21, 2009 Author Share Posted February 21, 2009 I'm submitting a form with hidden fields that contain check values and seem random. I need to grab the the page, submit the form based off data from the grabbed page. The catch is, if I grab the page again, then the values change. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted February 21, 2009 Share Posted February 21, 2009 In other words you're trying to circumvent some check that's in place to ensure that a user is actually making the request and not an automated script? I don't really care if that's what you're trying to do, but you might as well be honest about it. Quote Link to comment Share on other sites More sharing options...
sug15 Posted February 21, 2009 Author Share Posted February 21, 2009 In other words you're trying to circumvent some check that's in place to ensure that a user is actually making the request and not an automated script? I don't really care if that's what you're trying to do, but you might as well be honest about it. Basically, yes. Except I'm not going to use it for spamming. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted February 21, 2009 Share Posted February 21, 2009 They're not particularly difficult to get around - which is why i wouldn't rely on them. To be able to work round it, you need to understand how it works. When the form is loaded, some sort of pseudorandom number/string is stored in a hidden field. It is also stored in a session. When the form is submitted, the values in the hidden field and the session are compared. If they're equal, it means the user loaded the form prior to submitting it. If they're not, it means someone posted the form directly, without visiting the form page first. So, in order to have an automated request do this, it must be able to accept a cookie so that the session ID can be created on the first request and be the same on the second. Happily, cURL provides cookie functionality. So that's what you need to look up. Quote Link to comment Share on other sites More sharing options...
sug15 Posted February 21, 2009 Author Share Posted February 21, 2009 Great, thanks so much for the help. I tried on other forums, but no one else would help. So thanks a lot, I'll post back with results. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.