default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / fs_selfservice / php / freeside_signup_example.php
1 <?
2
3 require('freeside.class.php');
4 $freeside = new FreesideSelfService();
5
6 $response = $freeside->new_customer( array(
7   'agentnum'       => 1,
8
9   'first'          => $_POST['first'],
10   'last'           => $_POST['last'],
11   'address1'       => $_POST['address1'],
12   'address2'       => $_POST['address2'],
13   'city'           => $_POST['city'],
14   'state'          => $_POST['state'],
15   'zip'            => $_POST['zip'],
16   'country'        => 'US',
17   'daytime'        => $_POST['daytime'],
18   'fax'            => $_POST['fax'],
19
20   'payby'          => 'BILL',
21   'invoicing_list' => $_POST['email'],
22
23   'pkgpart'        => 2,
24   'username'       => strtolower($_POST['username']),
25   '_password'      => strtolower($_POST['password'])
26 ) );
27
28 error_log("[new_customer] received response from freeside: $response");
29 $error = $response['error'];
30
31 if ( ! $error ) {
32
33     // sucessful signup
34
35     $custnum = $response['custnum'];
36
37     error_log("[new_customer] new signup with custnum $custnum");
38
39 } else {
40
41     // unsucessful signup
42
43     error_log("[new_customer] signup error:: $error");
44
45     // display error message to user
46
47 }
48
49 ?>