Step 1

Enter your contact information.

Step 2

Enter your project information.

Step 3

Choose the PHP programmers you want to hire.

Compare Free PHP Quotes





Country



Using Proxies with cURL in PHP

*Attention PHP Programmers* - Add A Free Listing! Get more clients.

Win a new Compaq Presario Notebook!

If you are new to using PHP and cURL please refer to the PHP cURL tutorial. It covers why you should using cURL (as opposed to file_get_contents) and goes over how to make cURL requests with a custom class.

This tutorial will cover how to use different types of proxies – SOCKS4, SOCKS5 and HTTP with cURL.

Basic cURL Request

We’ll start by creating a simple cURL script that requests the web page checkip.dyndns.org and displays the result on the screen. The website just displays our current IP address, this is useful when working with proxies. Below is our very basic cURL request.

$url = 'http://checkip.dyndns.org/';

$c = curl_init($url);

curl_setopt($c, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($c);

echo '<pre>';
var_dump($result);
echo '</pre>';

curl_close($c);

As we can expect, the output will be your IP address.

202.183.56.21

Using Proxies with cURL

To use proxies with cURL we need to set 2 additional cURL options: CURLOPT_PROXYTYPE and CURLOPT_PROXY. CURLOPT_PROXYTYPE should be set to either CURLPROXY_SOCKS5 or CURLPROXY_SOCKS4, depending on the type of proxy you are using. CURLOPT_PROXY should be set to the IP address and port of the proxy you are using.

If you are using an HTTP proxy then you only need to set CURLOPT_PROXY to your proxy. CURLOPT_PROXYTYPE automatically defaults to CURLPROXY_HTTP.

As you can expect, the following script displays the IP address of the proxy.

$url = 'http://checkip.dyndns.org/';

$c = curl_init($url);

curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($c, CURLOPT_PROXY, '68.119.83.81:27977');

$result = curl_exec($c);

echo '<pre>';
var_dump($result);
echo '</pre>';

curl_close($c);

Note: You’ll need to use your own proxy. The one supplied is made up.

Source http://query7.com/?p=982
Sun, 13 Feb 2011 21:30:21 GMT
Tags: php, Tutorials, Web Development,

*Attention PHP Programmers* - Add A Free Listing! Get more clients.


php


Developing a blog with CakePHP

If you want to develop a blog from sctrach without using any CMS like WordPress or Drupal, then you’ve come at the right place! In this series, we will understand how to develop a blog using
the CakePHP

A Look at PHP 5.3 Frameworks – Symfony2

Ever since PHP5.3 was released we have seen several new frameworks pop up in the PHP community. In this series of articles we will look at and evaluate some of the next generation PHP frameworks. Today we look at S

Tutorials


Interacting with Skype from Python using Skype4Py

Skype4Py is a Python module that allows developers to programatically interact with the Skype client running on their computer. In this tutorial we will look at and use the Skype4Py m

Titanium Mobile Android Development: Soundboard App

In this series of tutorials we use Appcelerator’s Titanium Mobile platform to create Android applications. This tutorial walks you through developing and packaging a soundboard application. Full source and packaged application is available on Titanium Mobile Android Development: Installation

In this series of tutorials we use Appcelerator’s Titanium Mobile platform to create Android applications. This tutorial goes over the installation and configuration of the Android SDK and Titanium Mobil

This Week in Web – PHP Namespaces, NodeTuts, Kohana

Interview with Matthew Weier O’Phinney

Kevin Schroeder, tech evangelist at Zend, recently interviewed Zend Framework lead Matthew Weier O’Phinney. The two talk about Weier O’

Members:
Franklin
Spectrum Nashville Profile
Spectrum Nashville

Spectrum Nashville is committed to providing reasonable, excellent business technology solutions that simply work.

Franklin, Tennessee US
Dunmore
Computer Wonders Profile
Computer Wonders

Get a website for $400.00. Please see our Facebook page for more details. http://www.facebook.com/Computer.Wonders

Dunmore, Pennsylvania US
Chennai
Anis technologies Profile
Anis technologies

website creator chennai, web development firm chennai, product development in chennai, software developer in chennai, website designer in chennai, portal developing firm chennai SEO and SEM solutions

Chennai, Tamil Nadu IN
Chelsea
Ann Arbor Software Profile
Ann Arbor Software

Chelsea, Michigan US
Daphne
Wild Goose Art Profile
Wild Goose Art

Web Design, Implementation, and Maintenance. PHP, Javascript, JQuery, MySql

Daphne, Alabama US
Design Leads


PHP Programmers Valid HTML 4.0 Transitional Valid CSS!

Titanium Mobile Android Development: First Application

In this series of tutorials we use Appcelerator’s Titanium Mobile platform to create Android appl



A Guide to Understanding Page-Speed Tests

Before you can optimize your website you first need to understand what your page speed tests are tel



Users Expect Websites to Load in the Blink of an Eye

Forget the two-second rule of conventional wisdom. Who has that kind of time? These days, say expert



Got Messy CSS? You’re not Alone

Woolly, the CSS sheep. You just got a new web design gig. There’s a blank CSS file staring ou



Simplify Your CSS With the ‘any()’ Selector

HTML5 adds a slew of new semantic tags to the web developer’s toolkit. Tags like section, arti



Article Tags
PHP Programmers Articles
Browsers| Web Standards| CSS| firefox| HTML5| Web Basics| Programming| Web Services| Mobile| JavaScript| Web Development| Visual Design| Multimedia| chrome| Google| responsive design| This Week in Web| CSS 3| Opera| Web Apps|
Friends:
Live Help Chat Software
Web Design Quote
Web Design