Hi Just found this which looks like it hits the spot !
var
Stream : TIdMultipartFormDataStream;
PostDataStream : TStringStream;
begin
PostDataStream := TStringStream.Create('');
Stream := TIdMultipartFormDataStream.Create;
try
Stream.AddFile( 'XMLData', 'C:\a\Test.xml', 'text/xml' );
IdHTTP1.Post('http://www.aaaaa.com.au/clc_UploadTest.php',
Stream, PostDataStream);
ShowMessage(PostDataStream.DataString);
finally
PostDataStream.Free;
Stream.Free;
end;
Which seems to work fine. However I now get a funny PHP message. But
I will take that to the offtopic section if required :)
Cheers
Robert martin wrote:
Hi all
I am wanting to send an XML file I have to a PHP script for
processing. I am wanting to use TidHttp and have the following code
snippet...
var
sResponse: String;
fsParams: TFileStream;
begin
fsParams := TFileStream.Create('.\test.xml', fmOpenRead or
fmShareDenyWrite);
try
IdHTTP.Request.ContentType := 'text/xml';
sResponse :=
IdHTTP.Post('https://secure.dev.gateway.gov.uk/submission',
fsParams);
ShowMessage(sResponse);
except
on E: Exception do
ShowMessage('Error encountered during POST: ' + E.Message);
end;
This was from a web site. Not mine !
But I wonder what should happen at the PHP end. When my scripts
processes usually things usually I go 'vardata = $_REQUEST[FieldName]
to get the value. Than my XML I should do something like
$xml = new SimpleXMLElement($vardata);
echo $xml->movie[0]->plot;
The question I have (which is Delphi related) is. My code doesn't pass
the XML file as a param (does it?) how should I do this or am I
misunderstanding.
Sorry if I have not been clear enough.
Thanks
Rob
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe
|
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject:
unsubscribe