Authentication problem with Wufoo
Posted
by fudgey
on Stack Overflow
See other posts from Stack Overflow
or by fudgey
Published on 2010-05-30T15:17:57Z
Indexed on
2010/05/30
15:22 UTC
Read the original article
Hit count: 451
I set up a Wufoo form with admin only portions that will only show up if I am logged in. I read through the Wufoo API documentation and I can get the authenication to work, but when I try to access the form after I authenticate, it says I need to authenticate. This is what I have so far (subdomain, api key & form id changed)
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$curl1 = curl_init('http://fishbowl.wufoo.com/api/v3/users.xml');
curl_setopt($curl1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl1, CURLOPT_USERPWD, 'AOI6-LFKL-VM1Q-IEX9:footastic');
curl_setopt($curl1, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl1, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl1, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($curl1, CURLOPT_USERAGENT, 'Wufoo Sample Code');
$response = curl_exec($curl1);
$resultStatus = curl_getinfo($curl1);
if($resultStatus['http_code'] == 200) {
echo 'success!<br>';
} else {
echo 'Call Failed '.print_r($resultStatus);
}
$curl2 = curl_init("http://fishbowl.wufoo.com/api/v3/forms/w7x1p5/entries.json");
curl_setopt($curl2, CURLOPT_HEADER, 0);
curl_setopt($curl2, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl2);
curl_close ($curl2);
echo $response;
curl_close($curl1);
?>
It doesn't matter if I close $curl1
before or after I call $curl2
, I get the same message on my screen:
success!
You must authenticate to get at the goodies.
and I know the api, subdomain and form id are all correct.
And one last bonus question... can I do all of this using Ajax instead? - the page I will be displaying the form on will already be limited to admin access, so exposing the API shouldn't matter.
© Stack Overflow or respective owner