Example #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>

Example #2
0
 static function get_and_decode_response($full_url)
 {
     // get the response
     $response = CSImport::get_url($full_url);
     // 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']);
     }
     // set object properties for future requests
     // $this->import_id = $resp['id'];
     return $resp;
 }