Jump to content

cURL Get Results


sug15

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.