Reading from website

What am I doing wrong here?

{note}The intention is to have a user type a ZIP, this zip is passed as variable ENTERZIP to http://www.geonames.org/postalcode-search.html?q={ENTERZIP}&country=US, where the results are displayed in a table w

and three values displayed as list. {endnote}

{note}Enter ZIP (USA): {formtext: name=ENTERZIP; cols=10}{endnote}
{urlload: GeoNames Fulltextsearch : {=ENTERZIP}; done=(res) -> {site: text; selector=.restable td:nth-child(2) .restable td:nth-child(3) .restable td:nth-child(4) li; multiple=yes}}

Hi @Zita_Daniel_Nad , the {site} command cannot parse arbitrary HTML as a string (the string may come from another variable, urlload, etc.). The {site} only works on the live HTML of the actual current page where you're running the snippet.

In this case, you might be able to use extractregex to grab the information that you need. Have you tried that?

1 Like

Thank you for the suggestion. I was trying to get it done without regex.

Is it possible to get what I am looking for at all using TB?
I need the user to be on one website and from the snippet entered in that website be able to type the ZIP and get the state and city inserted into the snippet from another wepage, using something like:


The website returns the results in the following format:
1 Ocean Beach 11770 United States New York Suffolk

My regex should match:
[a-zA-Z]+[[:blank:]][a-zA-Z]+[[:blank:]]\d\d\d\d\d[[:blank:]][a-zA-Z]+[[:blank:]][a-zA-Z]+[a-zA-Z]+[[:blank:]][a-zA-Z]+[[:blank:]][a-zA-Z]+/gm

OR
[a-zA-Z]+[[:blank:]]\d\d\d\d\d[[:blank:]][a-zA-Z]+[[:blank:]][a-zA-Z]+[a-zA-Z]+[[:blank:]][a-zA-Z]+[[:blank:]][a-zA-Z]+/gm



Please note this video is missing some details.
image

The JSON endpoinds are always more useful. So I'm trying that first. It gives the following JSON response for 11770:

{
    "postalcodes": [{
        "adminCode2": "103",
        "adminCode1": "NY",
        "adminName2": "Suffolk",
        "lng": -73.161286,
        "countryCode": "US",
        "postalcode": "11770",
        "adminName1": "New York",
        "placeName": "Ocean Beach",
        "lat": 40.644344
    }]
}

I am not familiar with the GeoNames api, but is it correct to say that the state name is always in adminName1 and the city name is always in adminName2?

My testing indicates the above to be true. Thank you so much for looking into this for me.

i ahve another regex/blaze related question, will I continue here or start a new thread?

Let's start a new thread! :slightly_smiling_face: