PHP Classes
elePHPant
Icontem

File: samples/index2.php

Recommend this page to a friend!
  Classes of Tom Schaefer  >  QTransfer  >  samples/index2.php  >  Download  
File: samples/index2.php
Role: Example script
Content type: text/plain
Description: sample: same as above but shorter
Class: QTransfer
Send HTTP requests and process XML responses
Author: By
Last change: change
Date: 9 years ago
Size: 820 bytes
 

Contents

Class file image Download
<?php

include_once 'config.inc.php';

// sends a request xml via curl to a server application
// and receives the response as xml

$request = new Transfer_XmlRequest("Test","Module","index");
$request->setSchema("request");
$request->render();

if(
$request->isValid()) {
   
$requestXML = $request->getXml();
} else {
    echo
"invalid request";
    exit;
}

$c = Transfer_Curl::getInstance()
            ->
doPostXML("http://www.query4u.de/test/index.php",$requestXML);


// transforms and validates the response against a schema
$response = new Transfer_XmlResponse("Test","Module","index");
$response->setSchema("response");
$response->setOutput($c);
$response->render();

if(
$response->isValid()) {
   
header("content-type: text/xml");
    echo
$response->getXml();
} else {
    echo
"invalid response";
}