Jump to content

PHP interact with other pages


chokk

Recommended Posts

I ask a lot of questions, I know, but only because there is so much I need to know, and you are the wisest people I know. <3Can PHP interact with other websites?What I mean by that is, can you make a php script login to another website using an account you've signed up for? Like, could I write a php script that could login to my w3schools forum account and post a new topic in this forum?

Link to comment
Share on other sites

You can use a library like cURL to send any requests you want. All your browser does is send requests and display responses, so you can use PHP to do the same. The problem is that you'll need to program the script to respond to the server. So you could send a request to log in, but you'll need to be manually checking for things like cookies which you need to send back to the server. So you could send one request to log in and get your session cookie and everything, and then another request to post a topic or whatever, you just need to know where to send the requests and what data the scripts expect.

Link to comment
Share on other sites

The process that JSG is referring to can also be referred to as an API, in those certain instances where there is a set of instructions for submitting a standardized request and in turn you'll get a standardized response. Sites such as Google Search/Maps, Facebook, and Twitter have these setup, so with the proper authentication (if needed), you can act on behalf of user to post, read status updates, get a map for your website, etc. They aim to streamline the process of making and receiving HTTP responses for developers.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...