sub199 sub199 - 20 days ago 5
Linux Question

Click button using curl

I need to fetch contact number from an URL, may be using curl.

Sample link- https://www.olx.pl/oferta/philips-sluchawki-bezprzewodowe-shc5100-CID99-IDiER3w.html#188a0d656b

Contact number button in on right hand side & value is hidden. Once you click on it, value shows up. There is no onclick event on button. Please let me know.

Answer

You can do it with combination of curl, sed and grep command outputs.

Here is an example:

wget -q -O - $(echo http://www.olx.pl/ajax/misc/contact/phone/$(curl -s  https://www.olx.pl/oferta/philips-sluchawki-bezprzewodowe-shc5100-CID99-IDiER3w.html#188a0d656b | grep link-phone | egrep -oh \'id\'\:\'\\S+\' | tail -n 1 | sed -e s/\'id\'\://g | sed -e s/\'//g))