http://code.google.com/apis/blogger/dev ... tocol.html adresinde bazi programlama dilleri icin gelistirilmis hazir kutuphaneler de mevcut. .net , java, php vs... bu kutuphaneler ile kolay bi sekilde bu apileri kullanabiliyorsunuz. delphi for .net icin de .net kutuphanesi kullanilabilir fakat ben simdilik bu islemi delphi for win32 ile yapmaya calistigimdan bu hazir kutuphanelerden pek fazla yararlanamiyorum.
herseyi adim adim kendim yapmam gerekiyor.
burdaki bilgilere gore login olma islemini basarili bir sekilde yapiyorum fakat is yeni bir yazi gondermek/silmek/duzenlemek olunca burda anlatilanlara gore herseyi yapmama ragmen HTTP 1.0 400 Bad Request
hatasi almaktan kurtulamiyorum.
turlu seyler denememe ragmen header bilgilerini kabul etmedi gitti su gugil

Kod: Tümünü seç
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdTCPConnection, IdTCPClient, IdHTTP, IdBaseComponent,
IdComponent, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL,
IdSSLOpenSSL,IdObjs;
type
TForm2 = class(TForm)
IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL;
Memo1: TMemo;
IdHTTP1: TIdHTTP;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
stringStream: TIdStringStream;
postStrings: TidStringList;
postResults: string;
begin
idhttp1.ReadTimeout :=5000;
postStrings := TIdStringList.Create;
try
postStrings.LineBreak := '&';
postStrings.Values['accountType'] := 'GOOGLE';
postStrings.Values['Email'] := 'xxxxxxxxxxxx@gmail.com';
postStrings.Values['Passwd'] := 'yyyyyyyy';
postStrings.Values['service'] := 'blogger';
postStrings.Values['source'] := 'bbbbb-aaaaa-1';
stringStream := TIdStringStream.Create(postStrings.Text);
try
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
postResults := IdHTTP1.Post('https://www.google.com/accounts/ClientLogin', stringStream);
Memo1.Lines.Add(postResults);
finally
stringStream.Free;
end;
finally
postStrings.Free;
end;
end;
procedure TForm2.Button2Click(Sender: TObject);
var
postResults:TStringStream;
params:TStringList;
myAuthorizationKey:String;
begin
postResults :=TStringStream.Create('');
params :=TStringList.Create;
myAuthorizationKey := copy(memo1.Text,pos('Auth=',memo1.Text),length(memo1.text));
idhttp1.Request.Clear;
idhttp1.Request.ContentType := 'application/atom+xml';
idhttp1.Request.CustomHeaders.Add('Authorization: GoogleLogin ' + myAuthorizationKey);
params.LoadFromFile('post.xml');
try
idhttp1.Post('http://www.blogger.com/feeds/myBlogID/posts/default', params,postResults);
memo1.Text:= postResults.DataString;
finally
FreeAndNil(postResults);
FreeAndNil(params);
end;
//HTTP 1.0 Bad Request
end;
end.
dfm dosyasi
Kod: Tümünü seç
object Form2: TForm2
Left = 0
Top = 0
Caption = 'Form2'
ClientHeight = 318
ClientWidth = 517
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Memo1: TMemo
Left = 8
Top = 39
Width = 501
Height = 271
Lines.Strings = (
'Memo1')
TabOrder = 0
end
object Button1: TButton
Left = 8
Top = 8
Width = 75
Height = 25
Caption = 'login ol'
TabOrder = 1
OnClick = Button1Click
end
object Button2: TButton
Left = 89
Top = 8
Width = 75
Height = 25
Caption = 'post gonder'
TabOrder = 2
OnClick = Button2Click
end
object IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL
MaxLineAction = maException
Port = 0
DefaultPort = 0
SSLOptions.Method = sslvSSLv2
SSLOptions.Mode = sslmUnassigned
SSLOptions.VerifyMode = []
SSLOptions.VerifyDepth = 0
Left = 424
Top = 8
end
object IdHTTP1: TIdHTTP
IOHandler = IdSSLIOHandlerSocketOpenSSL1
AllowCookies = True
ProxyParams.BasicAuthentication = False
ProxyParams.ProxyPort = 0
Request.ContentLength = -1
Request.Accept = 'text/html, */*'
Request.BasicAuthentication = False
Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
HTTPOptions = [hoForceEncodeParams]
Left = 456
Top = 8
end
end
post.xml
Kod: Tümünü seç
<entry xmlns='http://www.w3.org/2005/Atom'>
<title type='text'>Marriage!</title>
<content type='xhtml'>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Mr. Darcy has <em>proposed marriage</em> to me!</p>
<p>He is the last man on earth I would ever desire to marry.</p>
<p>Whatever shall I do?</p>
</div>
</content>
<author>
<name>sade</name>
<email>mailadresi@gmail.com</email>
</author>
</entry>