dcav wrote:
What's the difference between CURL and a PHP include or AJAX?
CURL is a library for making HTTP requests. It's integrated into PHP so that you can use the curl_* functions to make requests - usually from other web sites.
Some typical use cases for this are
- RPC to consume "web services" provided by other companies (for example, and very commonly, payment service providers)
- "Screen scraping" - fetching other peoples' web pages for some purpose - typically to obtain some data that they don't expose through a normal API
- Link checking
CURL is not the only way of doing this in PHP, in fact I'd argue that it's deprecated, as since PHP 4.3, you can use the fopen wrappers to achieve the same thing, except that you're not depending on the CURL library itself.
You can also achieve things such as HTTP posts without using curl, just using PHP fopen wrappers (You need to use stuff like stream_context_create)
I know for one, that you can launch scripts from another TLD (like AJAX),
XMLHttpRequest is a class which exists in most browsers to allow Javascript on the CLIENT SIDE to request things of a web site. However, usually it's restricted to the same server host name that the web page came from.
AJAX is a technique which uses XmlHttpRequest.
Flash and Java can also be used on the CLIENT side to make remote HTTP requests using their own APIs. Again, this is coming directly from the client.
The use-cases for using client-side stuff are different from server-side things.
Client-side:
- Making "AJAX" style pages, which trigger actions without a page reload, or reload parts of a page, or record data - from Javascript, Flash or Java
Server-side:
- Server-server RPC for third party services such as payment, data lookups (we are currently using a geographical data service provider)
- Link checking, screen scraping etc.
Mark