Am I using the form action correctly?
I am just beginning to use smartystreets. I am trying to use LiveAddress
API. Am I on the right track for submitting the request and getting back
the address components?
<?php
$authid = 'myauthid';
$authToken = 'myauthtoken';
$street = $_POST['street'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$req =
"https://api.smartystreets.com/street-address/?street={$street}&city={$city}&state={$state}&zipcode={$zipcode}&auth-id={$authId}&auth-token={$authToken}";
// GET request and turn into associative array
$result = json_decode(file_get_contents($req));
$result = json_decode(file_get_contents($req),true);
echo "<pre>";
print_r($result);
echo "</pre>";
?>
<form
action="https://api.smartystreets.com/street-address/?street={$street}&city={$city}&state={$state}&zipcode={$zipcode}&auth-id={$authId}&auth-token={$authToken}"
method="post">
<input type="hidden" id="" value="" />
<input type="text" id="street" value="" />
<input type="text" id="city" value="" />
<input type="text" id="state" value="" />
<input type="text" id="zipcode" value="" />
<input type="submit" value="submit" id="submit-button" />
</form>
Monday, August 26, 2013
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment