...
You may also sent your requested data through the function as an array() or even a JSON-object. Such call may look like this:
Code Block | ||||
---|---|---|---|---|
| ||||
doPost("http://test.com/", $postDataObject, CURL_POST_AS::POST_AS_JSON) |
...
A very basic call to the library may look like this:. By using the "parsed" key in the response, you'll get any supported output formatted correctly.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
require_once("tornevall_network.php");
$CURL = new \TorneLIB\Tornevall_cURL();
$getResponse = $CURL->doGet("https://api.tornevall.net/2.0/endpoints/getEndPoints");
print_r($getResponse['parsed']); |
For the moment the library supports following formats:
- PHP serialized objects
- json encoded data
- xml data
By their tags xml a SimpleXMLElement-decode will invoke as the response is received, which gives us support for both rss amongst others.
Note: SOAP is using our class Tornevall_SimpleSoap to handle soap-calls - by adding ?wsdl, &wsdl (depending on how the post/get-parameters looks) or setting CURL_POST_AS to POST_AS_SOAP, the SOAP handler will be activated - or not.
Making SOAP calls
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
require_once("tornevall_network.php");
$CURL = new \TorneLIB\Tornevall_cURL();
$Response = $CURL->doGet("https://test.com/wsdlService?wsdl");
echo "<pre>";
try {
$getResponse = $Response->getOneResponseHere();
print_R($getResponse['parsed']);
} catch (Exception $e) {
echo "Exception Thrown: " . $e->getMessage() . "\n";
$getResponse = $Response->getLibResponse();
}
echo "</pre>"; |