Command line CURL command converted to CFML using cfhttp

Hello,

I would like to convert this CURL command line to CFML using CFHTTP.    Is it possble?

Right now I output the code to a post.sh file.


Thank You!
##!/bin/sh

## Authenticate
## Requires $GDATA_PASSWORD to be set as an environment variable.
G_AUTH_TOKEN=`curl 2>/dev/null https://www.google.com/accounts/ClientLogin \
    -d Email=#email# \
    -d Passwd=#password#  \
    -d accountType=GOOGLE \
    -d source=curlExample \
    -d service=blogger \
  | grep '^Auth=' | cut -c 6-`

## Post on my blog.
curl -v --request POST -H "Content-Type: application/atom+xml" \
    -H "Authorization: GoogleLogin auth=$G_AUTH_TOKEN" \
    "http://www.blogger.com/feeds/#blogid#/posts/default" --data "@blogpost.xml"

Open in new window

LVL 6
rjohnsonjrAsked:
Who is Participating?
 
ThutM0seConnect With a Mentor Commented:
Sure. You would basically just open a CFHTTP tag with the POST method and specify your header values etc with cfhttpparam.

For example:

<cfhttp method="post" url="https://www.google.com/accounts/ClientLogin">

<cfhttpparam type="header" name="Content-type" value="application/atom+xml">

and so on. You'll have to specify the right types in your cfhttpparam tags for each piece of data your going to be posting. Check adobe live docs for the full syntax and parameters.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.