• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

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

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 6395
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic