Programmatically logging into a site

后端 未结 3 1569
情书的邮戳
情书的邮戳 2021-01-25 08:46

It might sound silly; but can we programmatically login into a site such as Linkedin by passing our user credentials (userid and password)? I am not talking about using OAuth or

3条回答
  •  [愿得一人]
    2021-01-25 09:06

    Yes, you could use a HttpWebRequest in order to send HTTP requests to a given URL. So the idea would be to POST your credentials to the given url which is supposed to authenticate the user and capture any cookies that could be used on subsequent requests to authenticated parts of the site.

    Of course that's pretty raw work, if the remote site provides an API you might also use this API as it will simplify things.

提交回复
热议问题