Interacting with a website

Hello,

I would like to be able to write and read information from the EPAs Greenhouse Gas Equivalencies Calculator: https://www.epa.gov/energy/greenhouse-gas-equivalencies-calculator

I'll start with just being able to communicate with the EPA website though.

Originally I had just an inject, http request, and debug.
I would receive an Access Denied message in the Debug window.

Access Denied

Access Denied

You don't have permission to access "http://www.epa.gov/energy/greenhouse-gas-equivalencies-calculator" on this server.

Reference #18.ae1fc917.1601401489.23bfa826

Based on something I saw in another forum post, I added a function block that sets a payload and header but I'm not quite sure what that is.

Now when I manually trigger the inject node, it appears that I am connecting to website but I receive a warning message too.

Warning: msg properties can no longer override set node properties. See bit.ly/nr-override-msg-props

https://www.epa.gov/energy/greenhouse-gas-equivalencies-calculator","tls":"","persist":true,"proxy":"","authType":"","x":650,"y":120,"wires":[["be36b298.2866d"]]},{"id":"be36b298.2866d","type":"debug","z":"4e2c17b6.392468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":810,"y":120,"wires":[]},{"id":"8a074f6.1eec6b","type":"comment","z":"4e2c17b6.392468","name":"EPA Greenhouse Gas Calculator","info":"","x":550,"y":40,"wires":},{"id":"a9c1a121.0ef84","type":"function","z":"4e2c17b6.392468","name":"set payload and headers","func":"msg.url = "https://https://www.epa.gov/energy/greenhouse-gas-equivalencies-calculator";\nmsg.headers = {};\nmsg.headers['USER-AGENT'] = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36';\n\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":120,"wires":[["2d15f59b.3b5bba"]]}]

That just means that if you want to use msg.something to override the something property in the node, it has to be empty in the node settings. It will not override if the field is not empty.


For the rest, I can't tell what you are trying to do. That page isn't designed to be driven externally and it is complex. The form "submission" is actually a JavaScript function. So you would have to disect what the page is actually doing and then reproduce it.

Frankly, it would probably be quicker to write your own dashboard using the provided calculations: Greenhouse Gases Equivalencies Calculator - Calculations and References | US EPA

Thanks for the help!

I saw the calculations and that is probably what I will end up doing.
I can use a few function blocks to do the math and write the outputs to my controller.

I'm still hoping to figure out how to interact with a website but that can wait for a different project where the site is simpler to interact with.

Thanks,

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.