MAMP + Wufoo API
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Wufoo Demo</title> | |
<!-- Latest compiled and minified CSS from Bootstrap so the page don't look like ass --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> | |
</head> | |
<body> | |
<div class="container"> | |
<h1 class="page-header">Wufoo Demo</h1> | |
<pre><code> | |
<?php | |
$curl = curl_init('https://fishbowl.wufoo.com/api/v3/users.xml'); //1 | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //2 | |
curl_setopt($curl, CURLOPT_USERPWD, 'AOI6-LFKL-VM1Q-IEX9:footastic'); //3 | |
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); //4 | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($curl, CURLOPT_USERAGENT, 'Wufoo Sample Code'); //5 | |
// ssl configurations required to make MAMP play nice | |
curl_setopt($curl, CURLOPT_SSLVERSION, 1); | |
curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST, 'TLSv1'); | |
$response = curl_exec($curl); //6 | |
$resultStatus = curl_getinfo($curl); //7 | |
if($resultStatus['http_code'] == 200) { //8 | |
echo htmlentities($response); | |
} else { | |
echo 'Call Failed '.print_r($resultStatus); //9 | |
} | |
// more error info | |
// $curlError = curl_error($curl); | |
// echo $curlError; | |
?> | |
</code></pre> | |
</div><!-- end of container --> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment