Skip to content

Instantly share code, notes, and snippets.

@BaylorRae
Created September 3, 2010 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BaylorRae/564675 to your computer and use it in GitHub Desktop.
Save BaylorRae/564675 to your computer and use it in GitHub Desktop.
Wufoo API - getEntryCountToday
<?php
// Added inside of the WufooApiWrapper Class
public function getEntryCountToday($identifier, $from ='forms') {
$url = $this->getFullUrl($from.'/'.$identifier) . '?IncludeTodayCount=true';
// echo $url;
// die;
$this->curl = new WufooCurl();
$countObject = json_decode($this->curl->getAuthenticated($url, $this->apiKey));
echo '<pre>';
print_r($countObject);
echo '</pre>';
// return $countObject->EntryCountToday;
}
// Usage
include 'Wufoo-API/WufooApiWrapper.php';
$wrapper = new WufooApiWrapper($apiKey, $subdomain);
$wrapper->getEntryCountToday('z7x4a9');
?>
<?php
// This was my second attempt, but I got the same response.
$curl = curl_init('https://baylorrae.wufoo.com/api/v3/forms/z7x4a9.json?IncludeTodayCount=true');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, $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);
if($resultStatus['http_code'] == 200) {
echo htmlentities($response);
} else {
echo 'Call Failed '.print_r($resultStatus);
}
?>
stdClass Object
(
[Forms] => Array
(
[0] => stdClass Object
(
[Name] => Contact Form
[Description] =>
[RedirectMessage] => Success! Thanks for filling out my form!
[Url] => contact-form
[Email] => baylorrae@gmail.com
[IsPublic] => 1
[Language] => english
[StartDate] => 2000-01-01 12:00:00
[EndDate] => 2030-01-01 12:00:00
[EntryLimit] => 0
[DateCreated] => 2010-06-16 15:56:48
[DateUpdated] => 2010-08-03 18:27:16
[Hash] => z7x4a9
[LinkFields] => https://baylorrae.wufoo.com/api/v3/forms/z7x4a9/fields.json?IncludeTodayCount=true
[LinkEntries] => https://baylorrae.wufoo.com/api/v3/forms/z7x4a9/entries.json?IncludeTodayCount=true
[LinkEntriesCount] => https://baylorrae.wufoo.com/api/v3/forms/z7x4a9/entries/count.json?IncludeTodayCount=true
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment