If you need to follow redirects within your php code using Curl and the open_basedir is set you came into some trouble. If you disable this directive all your directories with a 777 permission are not safe (if one or more website on the same server has some security issues). If you don’t have additional protections you should NEVER disable the open_basedir directive (at least if you’re using 3rd party applications).
These days I needed a script to backup only a part of a customers website using a CRON. Most of the control panels I know allow only a complete website backup and this is not what I needed. While plaaning the script, I thought about a solution for webmaster without full SSH access to their hosting account. A typical situation could be:
* A shared hosting account that allows only backups for the whole site incl. database, emails and other settings
* No administration rights via SSH
* A FTP host for the storage of the the backup files
* Support for cURL and a default PHP5 configuration (sorry no more code for PHP4).
ext/curl is the common tool of choice, if one needs to perform more advanced HTTP requests from a PHP script (for simple ones, use a stream!). I recently wanted to perform a HEAD request to a file, after which I wanted to perform some more advanced HTTP interaction, so CURL was also the tool of choice here.
Trying it out on the shell with a local web server, CURL was operating quite slow, in contrast to a GET request. The -i command line switch makes curl include the headers in the printed output, -X lets you define a custom HTTP request.
FTP hosting is often much cheaper than regular web hosting. The upload with an ftp client is for sure the most common way, but could be a problem for people behind a firewall or without enough rights (capabilities) to install a FTP client. For those a upload via a web form is the best solution.
In this tutorial you will learn how to build a PHP script that scrapes links from any web page.
What You’ll Learn
1. How to use cURL to get the content from a website (URL).
2. Call PHP DOM functions to parse the HTML so you can extract links.
3. Use XPath to grab links from specific parts of a page.
4. Store the scraped links in a MySQL database.
5. Put it all together into a link scraper.
6. What else you could use a scraper for.
7. Legal issues associated with scraping content.
What You Will Need
* Basic knowledge of PHP and MySQL.
* A web server running PHP 5.
* The cURL extension for PHP.
* MySQL - if you want to store the links.
The first step when building a PHP search engine, link checker, or keyword extractor is to get the web page from the web server. There are several ways to do this. From PHP 4 onwards, the most flexible way uses PHP’s CURL (Client URL) functions. This tip shows how.
cURL is one of the most powerful PHP extensions. It stands for Client URL, and allows you to communicate with other servers using a wide range of protocols. Perhaps that sounds fairly uninteresting, but give it some more thought. Other servers and other protocols? At some stage in a novice developer's career, there comes a time to break out of the local server, and cURL is the first thing you should consider. I first used cURL for quite a simple task - processing a file on an FTP server. Later for dealing with merchant payments to create a transparent way of handling credit card authentication. And later still as a convenient way to get data from Amazon.com. The possibilities are almost limitless. I haven't even scratched the surface of what cURL can do, but for certain it's a powerful library.
Articles by Sojish Krishnan LibcURL is a free and easy-to-use client-side URL transfer library. Its used often for getting files using URL syntax. cURL is an important library for PHP software such as Billing software like ModernBill ). LibcURL library allows these software to communicates with banks and payment gateways remotely.
In this article , we'll see how to install or upgrade libcurl to a new version ( 7.15.3 ) and then integrate it to the PHP running in the server. Following steps were successfully tested on a Plesk 7.5 server running on RHEL-3.
In this article you will learn what the CURL library is, how to use it, and some of its (advanced) options.
From with a PHP program, I'd like to make an HTTP request and use the response body in my program. What could be simpler? PHP has a zillion ways to do it, not limited to: file_get_contents(), fopen() and fread(), fsockopen(), curl, and PEAR HTTP_Request.
One additional requirement that makes this slightly more interesting: I don't want to waste any memory on a response body that's too big. If I slurp in a giant request body, I might run over my memory_limit.
Here's what I came up with to solve this problem:








