Article View: borland.public.cppbuilder.internet.socket
Article #3081What's wrong with this?
From: dzeidzei
Date: Wed, 16 Nov 2005 11:17
Date: Wed, 16 Nov 2005 11:17
55 lines
2238 bytes
2238 bytes
Hi,
I've tried to wrote a little dll for doing http and https post with indy TIdHTTP.
Here is my code:
AnsiString * HttpsPostSMS(AnsiString *Url, AnsiString *Params)
{
AnsiString *asRet = new AnsiString;
TIdHTTP *IdHTTP = new TIdHTTP(NULL);
IdHTTP->Request->ContentType = "application/x-www-form-urlencoded";
TIdConnectionInterceptOpenSSL *IdConnectionInterceptOpenSSL = new TIdConnectionInterceptOpenSSL(NULL);
IdConnectionInterceptOpenSSL->SSLOptions->Method = sslvSSLv23;
IdConnectionInterceptOpenSSL->SSLOptions->Mode = sslmClient;
IdConnectionInterceptOpenSSL->SSLOptions->VerifyDepth = 0;
IdHTTP->Intercept = IdConnectionInterceptOpenSSL;
IdHTTP->InterceptEnabled = true;
TStringStream * tsResponse = new TStringStream("");
TStringStream * tsParams = new TStringStream(*Params);
try
{
IdHTTP->Post(*Url, tsParams, tsResponse);
tsResponse->Position = 0;
*asRet = tsResponse->DataString.Trim();
}
catch(Exception &e)
{
*asRet = "Error: " + e.Message;
}
delete IdHTTP;
IdHTTP = NULL;
delete IdConnectionInterceptOpenSSL;
IdConnectionInterceptOpenSSL = NULL;
delete tsParams;
tsParams = NULL;
delete tsResponse;
tsResponse = NULL;
return asRet;
}
And when I try to call function above it'll trow 'Intercept value is not valid'?
Can someone tell what i've missed?
Thanks.
- dzeidzei
Technical Details
Message-ID:
<437b2354$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,4165e9ea369c7fad,start X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "dzeidzei" <dzeidzei@suolakaivos.com> Sender: "dzeidzei" <dzeidzei@suolakaivos.com> Reply-To: "dzeidzei" <dzeidzei@suolakaivos.com> Subject: What's wrong with this? Newsgroups: borland.public.cppbuilder.internet.socket X-User-Info: 192.107.203.51 NNTP-Posting-Host: 207.105.83.66 Message-ID: <437b2354$1@newsgroups.borland.com> Date: 16 Nov 2005 04:17:24 -0700 X-Trace: newsgroups.borland.com 1132143444 207.105.83.66 (16 Nov 2005 04:17:24 -0700) Lines: 55 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail