assim que ia editar nosso amigo Daniel Postou rsrs
tem esse método aqui tambem, so vc adaptar as suas necessidades
#include "hmg.ch"
Function Main()
Mandrill_()
Return Nil
****************************************************************************************
Function Mandrill_()
Local cURL, cApiUrl := "https://mandrillapp.com/api/1.0"
Local cAPIKey:="SomeAPIKey"
Local cPOSTdata
LOCAL h, oMandrill, hResp
//Init
BEGIN SEQUENCE WITH {|o| break(o)}
oMandrill := Win_OleCreateObject( "MSXML2.ServerXMLHTTP" )
RECOVER
MsgStop( "Microsoft XML Core Services (MSXML) 6.0 is not installed."+CRLF+;
"Download and install MSXML 6.0 from http://msdn.microsoft.com/xml"+CRLF+;
"before continuing.")
oMandrill:=""
END SEQUENCE
IF EMPTY(oMandrill)
MsgStop("Error while init.")
RETURN
ENDIF
//ping
//https://mandrillapp.com/api/docs/users.JSON.html#method=ping2
MsgInfo('Prepare for Ping')
cURL := cApiUrl + "/users/ping2.json"
h := { => }
h [ "key" ] := cAPIKey
cPOSTdata := hb_jsonEncode( h , .T. ) //send as JSON
cResp := SendMandrill( cUrl, cPOSTdata, oMandrill )
IF cResp = "!ERROR!"
MsgStop( cResp ) /* Report any errors */
ELSE
MsgInfo( cResp , 'Response from server as JSON string')
hResp := hb_jsonDecode( cResp )
MsgDebug( hResp )
cStatus := hb_HGet( hResp , "status" )
nCode := hb_HGet( hResp , "code" )
cName := hb_HGet( hResp , "name" )
cMessage := hb_HGet( hResp , "message" )
MsgDebug( cStatus , nCode , cName , cMessage )
ENDIF
//Close
oMandrill:Abort()
RETURN
*****************************************************************************************
Function SendMandrill (cUrl, cPOSTdata, oMandrill)
Local cReturn
BEGIN SEQUENCE WITH {|o| break(o)}
oMandrill:Open( "POST", cUrl, .F. )
oMandrill:setRequestHeader("User-Agent", "Mandrill-Curl/1.0")
oMandrill:Send( cPOSTdata )
cReturn := oMandrill:ResponseBody()
RECOVER USING oErr
cReturn := "!ERROR!" + CRLF + oErr:Description
END SEQUENCE
RETURN cReturn
*****************************************************************************************
Créditos :
http://www.hmgforum.com/viewtopic.php?f=6&t=5578
A arte de programar é simplesmente fazer seus pensamentos serem interpretados por uma maquina :) clipper 5.3 /harbour/minigui