[DUG] XML and PHP

bevan at achieve.co.nz bevan at achieve.co.nz
Mon May 11 16:56:54 NZST 2009


Hi Rob,

I don't know if anyone answered this, but you can use the following to get the posted XML data and then load that into your XML processor.

$req = file_get_contents("php://input");

Regards,

Bevan



 On Mon 11/05/09 11:21 AM , Robert martin rob at chreos.co.nz sent:
> 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
> 
> 



More information about the Delphi mailing list