Skip to content

Commit

Permalink
progress with php api usage sample
Browse files Browse the repository at this point in the history
  • Loading branch information
jankom committed Sep 25, 2010
1 parent 5e32030 commit 1516c73
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 78 deletions.
Binary file added php/.api-explorer.php.swp
Binary file not shown.
Binary file added php/.api-invfox.php.swp
Binary file not shown.
39 changes: 2 additions & 37 deletions php/api-explorer.php
@@ -1,39 +1,5 @@
<html>
<body>
<style>
body {
font-size: 12px;
font-family: Trebuchet MS, Arial, Tahoma;
padding: 0px;
margin: 0px;
}
div.type {
float: right;
color: gray;
font-weight: bold;
padding-right: 10px;
}
h1 {
margin: 0px;
padding 20px;
background-color: #444444;
color: white;
}
pre.req {
padding: 20px;
background-color: #f1f1f1;
}
pre.resp {
padding: 20px;
background-color: #f1f1f1;
}
form {
padding: 20px;
background-color: #f1f1ff;
}
</style>
<h1>InvoiceFox API explorer</h1>
<?php
include "style/header.php";
require_once "lib/strpcapi.php";
require_once "lib/invfoxapi.php";

Expand Down Expand Up @@ -64,6 +30,5 @@
<br/>
arguments: <br/><textarea name="args" cols="100" rows="5"></textarea><br/>
<input type="submit" name="call" value="Call" />
</body>
</html>
name=asdasd&street=asdasds&postal=12312&city=asdasd&vatid=&phone=&website=&email=&notes=&vatbound=0&custaddr=&payment_period=14&street2=asdsad
<?php include "style/footer.php"; ?>
88 changes: 47 additions & 41 deletions php/api-invfox.php
@@ -1,54 +1,60 @@
<html>
<body>
<style>
body {
font-size: 12px;
font-family: Trebuchet MS, Arial, Tahoma;
padding: 0px;
margin: 0px;
}
div.type {
float: right;
color: gray;
font-weight: bold;
padding-right: 10px;
}
h1 {
margin: 0px;
padding 20px;
background-color: #444444;
color: white;
}
pre.req {
padding: 20px;
background-color: #f1f1f1;
}
pre.resp {
padding: 20px;
background-color: #f1f1f1;
}
form {
padding: 20px;
background-color: #f1f1ff;
}
</style>
<h1>InvoiceFox API explorer</h1>
<?php
include "style/header.php";
require_once "lib/strpcapi.php";
require_once "lib/invfoxapi.php";

if (isset($_POST['call'])) {

$api = new InvfoxAPI('vr64g6891lgatnf83dmxticsc10ashr2f4s9ye7w');

$resp = $api->assurePartner("name=asdasd&street=asdasds&postal=12312&city=asdasd&vatid=&phone=&website=&email=&notes=&vatbound=0&custaddr=&payment_period=14&street2=asdsad");
$r = $api->assurePartner(array(
'name' => 'asdasd',
'street' => 'asdasds',
'postal' => '12312',
'city' => 'asdasd',
'vatid' => '',
'phone' => '',
'website' => '',
'email' => '',
'notes' => '',
'vatbound' => 0,
'custaddr' => '',
'payment_period' => 14,
'street2' => 'asdsad'
));

echo "<br/><div class='type'>response</div><pre class='resp'>"; print_r($resp->res); echo "</pre>";

$rd = json_decode($r, true);

if ($rd[0] == 'ok') {

$clientId = $rd[1][0]['id'];

$r = $api->createInvoice(
array(

),
array(
array(

)
)
);

$rd = json_decode($r, true);

if ($rd[0] == 'ok') {

$api->downloadPDF($rd[1][0]['id']);

}

}

}

}
?>
<form method="post">
<input type="submit" name="call" value="Call" />
</body>
</html>
name=asdasd&street=asdasds&postal=12312&city=asdasd&vatid=&phone=&website=&email=&notes=&vatbound=0&custaddr=&payment_period=14&street2=asdsad
<form method="post"><input type="submit" name="call" value="Call" /></form>
<?php include "style/footer.php"; ?>
Binary file added php/lib/.invfoxapi.php.swp
Binary file not shown.
Binary file added php/style/.footer.php.swp
Binary file not shown.
Binary file added php/style/.header.php.swp
Binary file not shown.
2 changes: 2 additions & 0 deletions php/style/footer.php
@@ -0,0 +1,2 @@
</body>
</html>
35 changes: 35 additions & 0 deletions php/style/header.php
@@ -0,0 +1,35 @@
<html>
<body>
<style>
body {
font-size: 12px;
font-family: Trebuchet MS, Arial, Tahoma;
padding: 0px;
margin: 0px;
}
div.type {
float: right;
color: gray;
font-weight: bold;
padding-right: 10px;
}
h1 {
margin: 0px;
padding 20px;
background-color: #444444;
color: white;
}
pre.req {
padding: 20px;
background-color: #f1f1f1;
}
pre.resp {
padding: 20px;
background-color: #f1f1f1;
}
form {
padding: 20px;
background-color: #f1f1ff;
}
</style>
<h1>InvoiceFox API explorer</h1>

0 comments on commit 1516c73

Please sign in to comment.