Path: <input name="path" value="<?php 
echo $path;
?>
"><br>
    Request method: <select name="method">
        <option>GET</option>
        <option>POST</option>
        <option>PUT</option>
        <option>DELETE</option>
        <option>OPTIONS</option>
    </select><br>
    Query string:  <input name="queryString" value="<?php 
echo $queryString;
?>
"><br>
    Post data:  <textarea rows="10" cols="40" name="postData"><?php 
echo $postData;
?>
</textarea><br>
    <input type="submit">
</form>

<?php 
if (array_key_exists('serviceUrl', $_POST)) {
    require_once 'yuduapi/yuduapi.php';
    parse_str($queryString, $queryVariables);
    sendYuduRequest($_POST['method'], $yuduConfig['serviceUrl'] . $path, $queryVariables, $postData, $yuduConfig);
}
?>
</body></html>
Ejemplo n.º 2
0
$return = sendYuduRequest('DELETE', $subscriptionPeriodUri, $queryVariables, $postData, $yuduConfig);
?>

<!-- ------------------------------------------------------------------------------------------------------------ -->
<h1>Example: Delete reader</h1>
<!-- ------------------------------------------------------------------------------------------------------------ -->

<?php 
$postData = "";
$queryVariables = array();
$return = sendYuduRequest('DELETE', $readerUri, $queryVariables, $postData, $yuduConfig);
?>

<!-- ------------------------------------------------------------------------------------------------------------ -->
<h1>Example: Exception handling - deleting non-existent reader</h1>
<!-- ------------------------------------------------------------------------------------------------------------ -->

<?php 
// The reader at $readerUri has already been deleted by the previous example
// sendYuduRequests throws a YuduApiException
try {
    $postData = "";
    $queryVariables = array();
    $reader = sendYuduRequest('DELETE', $readerUri, $queryVariables, $postData, $yuduConfig);
} catch (YuduApiException $e) {
    print "Error type: " . $e->getErrorType() . ", Error message: " . $e->getMessage();
}
?>

</body></html>