Send URL to HA

I need to send a URL to HA to handle a request.

javascript:%7Bwindow.location=‘SERVER?url=’+encodeURIComponent(window.location.href)%7D

With that code I can send the url to a php server, but I am not sure how to integrate this into HA.

The goal is to download the URL with a CLI command from HA. So I would need to pass the URL to that shell script.

Any ideas?

Something like that?
command: "sh /home/pi/.homeassistant/scripts/wind_direction.sh {{ states('sensor.wind_direction') }}"

But how do I get the URL passed from the API?

I guess I need something like this: http://HA_API/run_command_x?=URL