How can I fill, submit & and get result from a form located in another website using PHP ?

I'm trying to run a php script which fills a field located in a specified url, hits submit and returns the text shown after submitting.
how do I do that?
for example, I'd like to fill the fields on this website - https://www.timeanddate.com/date/duration.html (calculates the days since date1 till date2) and get the result after hitting the "calculate duration" button.

Can you give an example of a web form that would not be easier to just code directly rather than scraping from elsewhere? Each web form has its own way of doing things, so it's not trivial to generalize. This may be a starting point: http://form.guide/php-form/php-form-submit.html

Omri Ben Lulu

Greenhorn

Posts: 2

posted 1 year ago

Tim Moores wrote:Can you give an example of a web form that would not be easier to just code directly rather than scraping from elsewhere? Each web form has its own way of doing things, so it's not trivial to generalize. This may be a starting point: http://form.guide/php-form/php-form-submit.html

these are the elements from the website I'm trying to execute my script on:

the text field:

the submit button:

the text shown when hitting submit:

God is a comedian playing for an audience that is afraid to laugh - Voltair. tiny ad: