• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Sending and processing an XML request - need advice

darkroast

Member
Hello all -

I'm working on a process which needs to be able to verify an address (US only) via the US Postal Service API, which uses an XML request and response, then update the appropriate fields in the form. Ideally, I'd like to have the user enter the address information, then click a button which will send the request; when the response is received, the system will process the XML response, and update the fields.

Here's an example of the request:
http://production.shippingapis.com/...PI=Verify&XML=<AddressValidateRequest USERID="xxxxxxxxxxxx">
<Address>
<Address1></Address1>
<Address2>6406 Ivy Lane</Address2>
<City>Greenbelt</City>
<State>MD</State>
<Zip5></Zip5>
<Zip4></Zip4>
</Address>
</AddressValidateRequest>

and the response it brings back (assuming the address is valid):
<?xml version="1.0"?>
<AddressValidateResponse>
<Address ID="0">
<Address2>6406 IVY LN</Address2>
<City>GREENBELT</City>
<State>MD</State>
<Zip5>20770</Zip5>
<Zip4>1440</Zip4>
</Address>
</AddressValidateResponse>

I assume this could be done using PHP, but I'm not as familiar as I'd like to be with XML requests / responses. If I used PHP, I know how to use the placeholders to insert the address info into the request. But I'd appreciate any advice on how to create and send the request, and process the response, using Fabrik.

Possibly, if I get this working, I'll put together a plugin of some sort so that I can share this back with the community.
 
I've done something like this with a weather API and json format. Example
Code:
<?php
$json_string = file_get_contents("http://api.wunderground.com/api/Your_Key/geolookup/conditions/q/IA/Cedar_Rapids.json");
$parsed_json = json_decode($json_string);
$location = $parsed_json->location->city;
$temp_f = $parsed_json->current_observation->temp_f;
echo "Current temperature in $location is: $temp_f \n";
?>

Doesn't your API provide any code example?
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top