-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgetter.php
More file actions
executable file
·49 lines (34 loc) · 1.48 KB
/
getter.php
File metadata and controls
executable file
·49 lines (34 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
require_once('config.php');
class WufooGetter {
private $url;
private $config;
public function __construct($url, $config) {
$this->url = $url;
$this->config = $config;
}
public function makeCall() {
$curl = curl_init('https://'.$this->config->subdomain.'.wufoo.com/'.$this->url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, $this->config->apiKey.':footastic');
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Wufoo Sample Code');
$response = curl_exec($curl);
$resultStatus = curl_getinfo($curl);
// This is fairly primitive error handling.
// The jQuery plugin tests for the type of the response and
// deals with it over there.
if ($resultStatus['http_code'] == 200) {
echo $response;
} else {
// Some folks may want to encode the error as JSON before
// outputting, so the JavaScript gets usable data no matter what.
echo 'Call Failed '.print_r($resultStatus);
}
}
}
$wufooGetter = new WufooGetter($_GET['url'], new jQueryConfig());
$wufooGetter->makeCall();
?>