简体   繁体   中英

Send data and submit form to different website and get result

Let's say I have a text <input> .

Is there any way to:

  • send the text in the input to a separate website with a login screen
  • fill in the login details

OR

  • fill in a search box on the site
  • submit the search
  • get search results

Assuming this is possible, can I retrieve the result? Can I display the results somehow in an <iframe> or something like that?

For the first part, if you know which form the data goes to and what data ( GET or POST variables), then you might be able to send data directly to that form via PHP. AFAIK, I don't think this is possible because of anti-cross-server safety measures except with certain libraries.

EDIT

  • With JS/jQuery and AJAX, this is not possible because of the "Same Origin Policy" .
  • In PHP, you can do this, using cURL .

For the second part, the "results" (ie, a search page, or an account/logged in/welcome page) should be a webpage that you can easily put in an <iframe> as normal. If you don't know how to use an <iframe> :

<iframe src="PAGE_URL">Your browser doesn't support iframe.</iframe>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM