Life and tech

21Dec/115

Using PHP and CURL to log in to a website

The other day I wanted to automate some downloading from a username and password secured website. I wrote a quick script and it is working like a dream, below is the CURL part of the code that does the logging in and download.

Tagged as: , 5 Comments
1Dec/110

PECL UUID extension on Mac OSX

Today I needed to set up the PECL UUID PHP module on my Mac OSX 10.7 Lion development machine, I needed it for a project that I'm working on.

My first reaction was to fire up terminal and run sudo pecl install uuid. It all looked good for a moment but then came to a grinding halt when 'make' failed.

Here is the error for reference (and for those searching snippets of it):

After a bit of googling I found out what the problem was and a solution to it. The full explanation and solution can be found here:

http://unrealexpectations.com/blog/2010/04/mamp-pecluuid-module-working-on-snow-leopard/

I can confirm that the patch and build worked on my set up (OSX 10.7 Loin) and I hope by spreading the word it some more people out.

30Nov/110

Installing and setting up PEAR

This post will help you get PEAR installed and up and running on your machine, there are two options to below, one describes an OXS Lion specific setup and the other is more generic.

Installing on OSX 10.7 Lion

OSX Lion already has the PEAR install bundle so there is no need to download it, open up a terminal window and enter the following commands:

 

Downloading and installing

Do not follow this part if you have just done the above steps. Otherwise enter the below into a terminal window:

It will ask you to enter a new installation base ($prefix). I recommend you use /usr/local

 

Configuring PHP include path

Edit /etc/php.ini and find the line: ;include_path = ".:/php/includes". Uncomment it (remove the ; at the beginning) and add the PEAR path to it. It should end up looking similar to the below:

 

Update PEAR

Now to update the install enter the 3 commands below into the terminal window:

 

Install PHPUnit

Just for good measure you will probably also want to install PHPUnit, if you do then execute the below command and your ready to go.

Tagged as: , , , , , , No Comments