Making a simple cURL request (Simple)

In PHP the most common method to retrieve a web resource, in this case a web page, is to use the cURL library, which enables our PHP script to send and receive HTTP requests to and from our target web server.

When we visit a web page in a client, such as a web browser, an HTTP request is sent. The server then responds by delivering the requested resource, for example an HTML file, to the browser, which then interprets the HTML and renders it on screen, according to any associated styling specification. When we make a cURL request, the server responds in the same way, and we receive the source code of the Web page which we are then free to do with as we will in this case perform by scraping the data we require ...

Get Instant PHP Web Scraping now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.