问题
Let say i have a website (called s1.com..?) with a login form. After you succesfully log on the website, you have a page with some status infos like : Ticket Closed. since... And then ai have a page, on another server that need to go on s1.com, log me in and then retreive the date if the ticket is closed...
I dont really need all of the script since i think i can figure it out, but i wonder how do i make the first part, connecting the webpage onto the s1.com webpage so ill be able to fetch data?
Thanks for any help guys!
回答1:
You can use either curl (link has an example) or fopen (see the examples section).
Note that using fopen
requires that the allow_url_fopen setting to be enabled, while curl
requires the curl
module to be enabled.
回答2:
I think You can also Use JSONP with jQuery, this is alternative of CURL ( i may b wrong ) here is some useful links
- First Link
- Second Link
- Third Link
来源:https://stackoverflow.com/questions/4882218/connect-to-an-external-website-with-php