简体   繁体   中英

php Login form, authenticate against another website

I currently have a login form on my website, which POSTs to another web based service(web portal) that i run. This allows people to login to the web portal directly from my home page(bypassing the actual login page of the portal). This is all working fine, except that if wrong username/password combo is entered, the form will still POST to the web portal, which then displays 'login failed'

Proposed Solution: Use CURL to perform a POST on the server side, and then check the responce html for the words 'Login Failed'. If the text 'Login Failed' is found, the login form should display an error. If the text 'Login Failed' is NOT found, the login form should continue to POST to the web portal.

Could someone please correct me if there is a simpler method? Any links or snippets that could point me in the correct direction would be gratefully received.

Maybe curl_error() will return suitable code?

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