I would like make a script using PHP (probably need JS) to send POST data to another webpage and get the result back.
For example, Domain A will have a form with a textbox and submit button, and Domain B will have a script which will fill the textbox and press the submit button and return the generated HTML page.
--- Original 2012 Answer ---
Use jquery; just load the page with a $.ajax() call. If you need to, you can use "jsonp" which works around the restrictions between calling pages from different domains.
The nice thing about using javascript is that you don't need any serverside languages.
--- 2018 edit ---
I realise now that you can't do a POST with jsonp (as it is essentially read-only) so this will only work if the website accepts the form as a GET (ie, the parameters in the URL). Otherwise, best to use Curl or similar as suggested in other answers.
The following lines of code can be written on another php script,
Now $result will contain the text received from the other website.
With JS: for security reasons not. Read on Same origin policy.
With PHP you can do what you want, including
POST
ing other servers. For example use CURL.