Archive: curl

 

If you are trying to get a curl script which needs follow on location functionality to run on a server which has either open_basedir or safe mode enabled you will get an error message similar to the following:
CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
After a bit of digging, some kind [...]



 

Some hosts disabled the ini setting allow_url_fopen. This also means that the ability to easily grab images by calling imagecreatefromjpeg($img) where $img is a url for an external image does not work.
This is a shame as this technique is pretty easy..
PLAIN TEXT
PHP:

$remote_img = 'http://www.somwhere.com/images/image.jpg';

$img = imagecreatefromjpeg($remote_img);

$path = 'images/';

imagejpeg($img, $path);

However I was tearing my hair [...]



 

If you have read through this blog, you will realise that I am a big fan of the cURL library for PHP. Also, when using windows to code - I like to use the XAMPP package to give me easy access to an Apache, PHP and MySQL stack.
So here is my quick guide to getting [...]



 

One of the most useful and powerful things you can do with PHP is to create a programme which will simulate a web browser and can grab data, post data to forms and generally interact with other web sites - automatically.
For PHP to be able to work like this it must have the CURL library [...]