>>>Thanks, where can I download wwHttp?
>>
>>It's part of West Wind Client Tools:
>>
>>
http://west-wind.com/WestwindClientTools.aspx>
>ah, no wonder I couldn't find it.
>
>>
>>It's not free though :-)
>>
>
>not a problem. If I can't get the free solutions to work I'll go this way.
There's a trial version that's fully functional though and you can certainly use that... it has a few nag boxes that pop up but other than that it provides all features.
Looks like this might be handy for your email issue as well.
+++ Rick ---
>
>>You can probably do what you need with vfpConnection too. The main point is that you have to post a JSON or XML document.
>>
>
>I have got much closer passing the json to vfpconnection, but I must hav esomething wrong with the url as I am getting a 404 error. I've sent a support request to the vendor to see if I have misunderstood.
>
>I also have an option of creating a c# dll or exe which can then use one of the vendor's tools to send the message.
>
>
>>+++ Rick ---
>>
>>
>>>
>>>>Looking at the docs it seems you need to post a JSON or XML document not POST variables.
>>>>
>>>>Something like this (with wwHttp):
>>>>
>>>>
>>>>TEXT TO lcJson
>>>>{
>>>> "account_sid": "AC5ef8732a3c49700934481addd5ce1659",
>>>> "api_version": "2010-04-01",
>>>> "body": "Jenny please?! I love you <3",
>>>> "num_segments": "1",
>>>> "num_media": "1",
>>>> "date_created": "Wed, 18 Aug 2010 20:01:40 +0000",
>>>> "date_sent": null,
>>>> "date_updated": "Wed, 18 Aug 2010 20:01:40 +0000",
>>>> "direction": "outbound-api",
>>>> "error_code": null,
>>>> "error_message": null,
>>>> "from": "+14158141829",
>>>> "price": null,
>>>> "sid": "MM90c6fc909d8504d45ecdb3a3d5b3556e",
>>>> "status": "queued",
>>>> "to": "+15558675309",
>>>> "uri": "/2010-04-01/Accounts/AC5ef8732a3c49700934481addd5ce1659/Messages/MM90c6fc909d8504d45ecdb3a3d5b3556e.json"
>>>>}
>>>>ENDTEXT
>>>>
>>>>DO wwHttp
>>>>loHttp = CREATEOBJECT("wwHttp")
>>>>loHttp.AppPostKey(lcJson)
>>>>loHttp.cContentType = "application/json"
>>>>
>>>>lcResponse = loHttp.HttpGet("https://api.twilio.com/2010-04-01/Accounts/AC5ef8732a3c49700934481addd5ce1659/Messages.json")
>>>>
>>>>
>>>>+++ Rick ---
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>I've been trying out an online service that allows you to send SMS. Unfortunately I am having difficulty understanding their samples and translating them to VFP.
>>>>>
>>>>>You can view their code samples for various languages here:
>>>>>
>>>>>
https://www.twilio.com/docs/api/rest/sending-messages>>>>>
>>>>>This is what their help desk sent to me:
>>>>>
>>>>>"But I can help you with making a POST call to send SMS from your application.
>>>>>
>>>>>You would need these:
>>>>>URL - You already have it
>>>>>Account Sid
>>>>>Auth token
>>>>>From, To and Body / MediaUrl as form parameters
>>>>>
>>>>>Check if that library does the following:
>>>>>
>>>>> Ability to set From, To, Body key value pairs in form rather than in the URL as query parameters. Also ensure that the library sets the Content-type to "application/x-www-form-urlencoded". If it doesn't please set the header manually.
>>>>>
>>>>> Ability to convert Account Sid & Auth token into a Base64 encoded value.
>>>>>
>>>>>If it doesn't, you may have to use any built-in / 3rd party VFP libraries to convert "Account Sid":"Auth token" combination to a Base64Encoded value.
>>>>>eg. if Account Sid = AC123434598475 & Auth Token = slak09j4g49j04j
>>>>>Base64Encode("AC123434598475:slak09j4g49j04j") - Do not forget the ':'
>>>>>Set this base64 Encoded value in "Authorization" header, but ensure you prefix the value with "Basic "
>>>>>So the header would look like,
>>>>>
>>>>>Authorization Basic < Base 64 encoded value >
>>>>>
>>>>>The header and form parameter, briefed above, is available in JSON example in the following article
>>>>>
https://www.twilio.com/docs/api/rest/sending-messages"
>>>>>
>>>>>This is the code I was trying:
>>>>>
>>>>>
SET LIBRARY TO vfpconnection.fll ADDITIVE
>>>>>
>>>>>*!* SetConnectTimeout(oAppInfo.ConnectTimeOut)
>>>>>*!* SetResponseTimeout(oAppInfo.ResponseTimeOut)
>>>>>SetConnectTimeout(30)
>>>>>SetResponseTimeout(30)
>>>>>
>>>>>*!* https://api.twilio.com/2010-04-01/Accounts/ACb832550f3d5e416b54a3ff1c0c7d08b1/Messages.json \
>>>>>*!* -d "Body=Jenny%20please%3F%21%20I%20love%20you%20<3" \
>>>>>*!* -d "To=%2B15558675309" \
>>>>>*!* -d "From=%2B14158141829" \
>>>>>*!* -d "MediaUrl=http://www.example.com/hearts.png" \
>>>>>*!* -u 'ACb832550f3d5e416b54a3ff1c0c7d08b1:{AuthToken}'
>>>>>
>>>>>m.lcURL = "https://api.twilio.com/2010-04-01/Accounts/ACb832550f3d5e416b54a3ff1c0c7d08b1/Messages.json"
>>>>>
>>>>>LOCAL ARRAY laPost[3,2]
>>>>>laPost[1,1] = "Body"
>>>>>laPost[1,2] = "Test Message from Frank via Twilio"
>>>>>laPost[2,1] = "To"
>>>>>laPost[2,2] = "+18689999999"
>>>>>laPost[3,1] = "From"
>>>>>laPost[3,2] = "+18688888888"
>>>>>
>>>>>IF NOT HttpPost(m.lcURL, @laPost, "", "APITrace()")
>>>>> MESSAGEBOX("An error occurred sending the SMS: " + m.cTraceData, 16, "Send SMS Via Twilio")
>>>>>ENDIF
>>>>>
>>>>>
>>>>>Can anyone help me get this clear in my head?