Exemplo n.º 1
0
?>
"/> <br />
FORM Body:<br /> 
<textarea rows="10" cols="40" name="body"><?php 
echo $_GET['body'];
?>
</textarea> <br />
<input type="submit"/>
</form>

<hr/>

<?php 
require_once 'csimport.php';
//  print_r($_GET['url']);
//  print_r($_GET['body']);
//  echo CSImport::forward_auth($_GET, $_POST);
if ($_GET['body']) {
    print "posting to url: {$_GET['url']} <br/>";
    print_r(CSImport::post_url($_GET['url'], $_GET['body']));
} else {
    print "getting url: " + $_GET['url'] + "<br/>";
    print_r(CSImport::get_url($_GET['url']));
}
?>
<hr />

</body>
</html>

Exemplo n.º 2
0
 static function post_and_decode_response($url, $params)
 {
     $params = CSImport::authenticated_params($params);
     // post the response
     $response = CSImport::post_url($url, $params);
     // decode the response into an asscoiative array
     $resp = CSImport::decode_response($response, 'json');
     if (array_key_exists('error', $resp)) {
         throw new CSException($resp['error']['message'], $response['code']);
     }
     return $resp;
 }