|
|
Curl Help
|
|
|
|
Mac Elite
Join Date: Jan 2001
Status:
Offline
|
|
Hi,
Is there an option to make curl not get the HTML? I just want it to get the cookie of a page.
Also, how can I submit a form with curl using PHP? I know what data needs to be sent.
Thanks!
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
Originally posted by timmerk:
Hi,
Is there an option to make curl not get the HTML? I just want it to get the cookie of a page.
Also, how can I submit a form with curl using PHP? I know what data needs to be sent.
To get the cookies:
Code:
-D/--dump-header <file>
Write the protocol headers to the specified file.
This option is handy to use when you want to store the cookies
that a HTTP site sends to you. The cookies could then be read in
a second curl invoke by using the -b/--cookie option!
When used on FTP, the ftp server response lines are considered
being "headers" and thus are saved there.
If this option is used several times, the last one will be used.
To submit a form:
Code:
-d/--data <data>
(HTTP) Sends the specified data in a POST request to the HTTP
server, in a way that can emulate as if a user has filled in a
HTML form and pressed the submit button. Note that the data is
sent exactly as specified with no extra processing (with all
newlines cut off). The data is expected to be "url-encoded".
This will cause curl to pass the data to the server using the
content-type application/x-www-form-urlencoded. Compare to -F.
If more than one -d/--data option is used on the same command
line, the data pieces specified will be merged together with a
separating &-letter. Thus, using '-d name=daniel -d skill=lousy'
would generate a post chunk that looks like
'name=daniel&skill=lousy'.
If you start the data with the letter @, the rest should be a
file name to read the data from, or - if you want curl to read
the data from stdin. The contents of the file must already be
url-encoded. Multiple files can also be specified. Posting data
from a file named 'foobar' would thus be done with "--data @foo-
bar".
To post data purely binary, you should instead use the --data-
binary option.
-d/--data is the same as --data-ascii.
If this option is used several times, the ones following the
first will append data.
All this and more are in the man pages for curl. On the command line type "man curl" for all the details.
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|