Wednesday, June 2, 2010

PHP and cURL for Windows OS

Hey guys,

I have stumbled upon a problem where I had to take advantage of the cURL language to use proxy. I didn't want to use sockets as I read it would be the longer way. I've spent over four hours trying different methods, testing different pieces of code to achieve a simple goal which is to be able to surft a page using PHP with Proxy.

Finally, after installing a bunch of DLL files, installing/removing different applications I had enough and deleted everything. I cleaned my computer from any possible PHP or Apache related folders and files. Instead I installed EasyPHP application version 5.3.2i.

So, here is the steps I took in order to make PHP and cURL work together with proxy.

1. Install the latest EasyPHP application. The setup file in the link includes PHP, Apache, MySQL, and PHPMyAdmin. You don't have to download anything else unless you want to.

2. Right click EasyPHP in the taskbar, hover over Configuration and in the slide-menu select PHP Extensions.

3. Place a check mark on the php_curl setting (even if it is red) and click Apply. Then Close.

4. Right click EasyPHP in the taskbar and select Explore. This will open up your www folder where you will store all your files with .php extension.

5. Inside your www folder create a test.php file to check if you have properly installed PHP and cURL. Inside your test.php script place this code:

6. Right click EasyPHP in the taskbar and select Local Web. This will open up your local server page with that test.php file you created. Click on the test.php file you see on the page to run it.

7. Press CTRL + F to open the search box and search for "curl support". Your results should come up just like the picture below. If you have followed my instructions properly cURL support will be indicated as enabled.

That's it for setting up cURL with PHP on Windows OS.

To see a working example, CLICK HERE.

No comments:

Post a Comment