Solved

curl proxy signup

Posted on 2013-05-25
2
335 Views
Last Modified: 2013-05-28
$config['use_proxy'] = FALSE;
$config['proxy'] = 'proxy.domain.com:3128';
$config['proxy_username'] = '';
$config['proxy_password'] = '';

Open in new window


function http_post_call($url = '', $referer = '', $postdata = '', $include_header = FALSE)
{
	global $config;
	global $gacookie;
	$arr_result = array();

	$ch = curl_init();

	if ($include_header !== FALSE)
		curl_setopt ($ch, CURLOPT_HEADER, TRUE);

	curl_setopt ($ch, CURLOPT_AUTOREFERER, 1);
	curl_setopt ($ch, CURLOPT_COOKIESESSION, 0);
	curl_setopt ($ch, CURLOPT_FAILONERROR, 0);
	curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0);
	curl_setopt ($ch, CURLOPT_FRESH_CONNECT, 1);
	curl_setopt ($ch, CURLOPT_POST, 1);
	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt ($ch, CURLOPT_UNRESTRICTED_AUTH, 1);

	curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 0);
	curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
	if ($config['use_proxy'] !== FALSE)
	{
		curl_setopt ($ch, CURLOPT_PROXY, $config['proxy']);
		curl_setopt ($ch, CURLOPT_PROXYUSERPWD, $config['proxy_username'].':'.$config['proxy_password']);
	}

	curl_setopt ($ch, CURLOPT_COOKIEFILE, $gacookie);
	curl_setopt ($ch, CURLOPT_COOKIEJAR, $gacookie);
	curl_setopt ($ch, CURLOPT_ENCODING, "");
	curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
	curl_setopt ($ch, CURLOPT_REFERER, $referer);
	curl_setopt ($ch, CURLOPT_URL, $url);
	curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0");

	$response = curl_exec($ch);
	$error = curl_error($ch);
	$info = curl_getinfo($ch);
	$err_no = curl_errno($ch);

	curl_close($ch);
	unset($ch);

	if ($err_no)
	{
	  echo $error;
	  echo '<META http-equiv="refresh" content="'.$config['refresh_interval'].'; URL=index.php"><br /><br />Back to the <a href="index.php">main page</a>.';
	  exit();
	}
	
	$arr_result['response'] = $response;
	$arr_result['error'] 	= $error;
	$arr_result['info'] 	= $info;
	$arr_result['err_no'] 	= $err_no;
	
	return $arr_result;
}

Open in new window



how to run this curl class by using a proxy

where to sign up for this type of proxy
0
Comment
Question by:rgb192
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39196989
Where does this come from?  Is there an online document that describes the API?
0
 

Author Closing Comment

by:rgb192
ID: 39202932
I can not discover the answers to these important questions, so it is not supported, I will look for another code sample
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question