views:

82

answers:

1

Greetings.

I'm trying to send a quick sms through google voice using their existing API. I think the api is what's left from the Grand Central days. They don't have much documentation. Here's where I got my documentation: http://posttopic.com/topic/google-voice-add-on-development

I can authenticate using cfhttp and get the correct response. Then I can get the "_rnr_se" value that is required for request from a google voice command.

When I send over the number, message, and required values (Authorization and _rnr_se), I get a "content-length" is required message from google. But since this is a dynamic post with different form fields, not a file, I'm not sure what to post as the content-length.

If I just put some arbitrary value like "1000" for the content-length, the request just sits there and I never get a response. If I put something like "0" or "500" it comes back with a 500 - "Internal Server Error".

Any ideas on how to get the correct value for content-length before I post?

<cffunction name="submitSMS">

    <cfhttp url="https://www.google.com/voice/sms/send/" method="post">
        <cfhttpparam type="header" name="Content-Length" value="???">
        <cfhttpparam type="header" name="Authorization" value="GoogleLogin auth=#SESSION.GoogleAuth#">
        <cfhttpparam name="id" value="" type="formfield">
        <cfhttpparam name="phoneNumber" value="+1#params.number#" type="formfield">
        <cfhttpparam name="text" value="#params.smsMessage#" type="formfield">
        <cfhttpparam name="_rnr_se" value="#SESSION.rnr#" type="formfield">
    </cfhttp>

    <cfdump var="#cfhttp.FileContent#"><cfabort>
</cffunction>
+1  A: 

The better way to do this is to just use the google voice java class here:

http://google-voice-java.googlecode.com

GuiDoody