0

Given this stack:

WordPress 5.3
GravityForms 2.4.15.6 (paid: common, right?)
Forms: 3rd-Party Integration (free: Link to WordPress plugin page)
Forms: 3rd-Party Inject Results (free: Link to WordPress plugin page)
Zillow GetSearchResults API (free: Link to Zillow API)

I've connected to Zillow's API and received the response contained in this file: Link to 3rd-Party Integration debug text file.

Now that I've connected, I am supposed to be able to extract either XML or JSON and replace/overwrite the contents of a given field (input_12) within the originating Gravity Form (or in my case, the confirmation) (visible here: link to Gravity Form) by following the instructions here link to 3rd Party Inject Results instructions on GitHub using a syntax that I simply can't figure out - something like:

XML

[env:Envelope/env:Body/ns1:Response/ns1:Resultstatus] => foo
[env:Envelope/env:Body/ns1:Response/ns1:Result] => bar
[env:Envelope/env:Body/ns1:Response/ns1:Description] => baz

or

JSON

[Body/Response/ResultStatus] => foo
[Body/Response/Result] => bar
[Body/Response/Description] => baz

in the Forms: 3rd-Party Inject Results field shown here: Dropbox screenshot

I am attempting to extract/display the "zestimate" element's "amount" field, but can't figure out the correct syntax/response path.

The successful Zillow XML response, along with the field(s) I need to capture can be seen in the text file here link to Zillow XML response

I have searched high and low, but correct syntax/formatting information is scarce on this specific topic/plugin, and I would like to accomplish this in the aforementioned stack, if at all possible.

I would greatly appreciate a guru's guidance in helping me format the correct syntax so I can get on with my freaking life. lol

Thanks in advance.

1 Answer 1

0

the first step is to extract the value with this kind of code, does it work for you ?

$xml = simplexml_load_string($result);
$value = (string) $xml->response->results->result->zestimate->amount;

var_export($value, FALSE);

the next step is to put the value in the form. the Gravity Form is not free then we cannot test it and I only find that in documentation : https://docs.gravityforms.com/gform_get_field_value/
if that doesn't help, you have to ask to gravity form support.

3
  • Thank you Kaperto! I will test it and report back. Nov 18, 2019 at 1:50
  • Kaperto, is this a PHP function to be included in the functions.php? I entered the field path you specified (response/results/result/zestimate/amount) into the Forms: 3rd-Party Inject Results field shown above (in the freshly added screenshot) to no avail. I would prefer to accomplish this in the plugin itself, if at all possible. Nov 18, 2019 at 5:57
  • functions.php is here to customise the theme. read this to develop a plugin : developer.wordpress.org/plugins
    – Kaperto
    Nov 18, 2019 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.