I have setup an internal proxy using php and curl. Most of it is done, however, I am having trouble setting HTTP_HOST header field. This is the code I am using:
Code on the proxy server::
$data_server_url = "http://IP_ADDRESS_OF_MY_CONTENT_SERVER/";
$request_uri="";
if(isset($_SERVER['REQUEST_URI'])) { $request_uri = $_SERVER['REQUEST_URI']; };
$curl_url="${data_server_url}${request_uri}";
//Pass all these fields as-they-are-got from the client to the content server.
//$field_array=array("HTTP_ACCEPT", "HTTP_ACCEPT_CHARSET",
//"HTTP_ACCEPT_ENCODING", "HTTP_ACCEPT_LANGUAGE", "HTTP_CONNECTION",
//"HTTP_HOST", "HTTP_REFERER", "HTTP_USER_AGENT");
//$curl_request_headers=array();
$pass_headers = array(
'Host' => 'HTTP_HOST',
'Accept' => 'HTTP_ACCEPT',
'Accept-Charset' => 'HTTP_ACCEPT_CHARSET',
...
PHP function to connect to pingomatic using cURL
Hi I'm creating a PHP fucntion to connect to pingomatic using CURL but the response is always.
Array ( [EXE] => XML-RPC server accepts POST requests only. )
here is my sample code...
function curl_getpage2(
$url,$data,
$referer = null,
$agent = null,
$header = null,
$timeout = 20,
$proxy = null,
$proxy_username = null,
$proxy_password = null) {
//getProxy();
if ($agent == null) {
$agent = getAgent();
}
if ($referer == null) {
$referer = getHost($url);
}
if (!is_array($header)) {
$header = array("Content-Type:text/xml","Host:".getHost($url),"User-Agent:$agent",
"Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language:en-us,en;q=0.5",
"Accept-Encoding:gzip,deflate",
...
Using PHP cURL with an HTTP Debugging Proxy
I'm using the app "Fiddler" to debug a GET attempt to a website via PHP cURL. In order to see the cURL traffic I had to specify that the cURL connection use the Fiddler proxy (see code below).
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'read_header');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_REFERER, "http://domain.com");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt");
curl_setopt($ch, CURLOPT_URL, "http://domain.com");
$response = curl_exec($ch);
But the problem is that in Fiddler I can ...
How to make a proxy using a php script?
Let's say i got a vps hosting with a dedicated ip, can i make a curl php script that receives a url, fetch it, and output it, and make all this as a proxy server, so i can put my vps ip in the proxy settings of the browser. Read more about script......
Is there any way to do that? Note: Please don't suggest me ...
MD5 password encryption and security
So you're using MD5 to encrypt your users passwords and you think it's fully secured? In this tutorial, I'll explain how to secure your MD5 passwords and how they work.
Many people think the MD5 hash string is the password but encrypted. It's in fact a 32-character hexadecimal number corresponding to the string you entered. It does not contains your password at all. But is ...
Exploring the Radiant CMS
Need to build a website or weblog? Just want a simple CMS that makes your life easier? Radiant is for you! In this article, we explore some of the unique features of Radiant by creating a simple website with the basic components: header, menu, content and the footer. Remember, Radiant can do a lot more than what is mentioned here.
Radiant is an open source Content ...
Secure Upload Methods in PHP
Here’s how to deal with file upload attacks against sites developed in PHP, and how to write more secure code to prevent these attacks.
In most Web applications, developers provide upload file functionality — images, for example. This functionality could be exploited by attackers to upload malicious “Web shell” code, which might give them command-prompt access to the server. In this article, we look ...
Attacks that Target PHP-based Instances
Beginning with Block sql injection of this series, we have covered all major attacks on Web applications and servers, with examples of vulnerable PHP code. In this article, we will cover those attacks that deal specifically with PHP, and which have not been discussed earlier.
Remote File Inclusion (RFI) attacks
Remote File Inclusion (RFI) is a technique used to attack Web applications from a remote ...
How to import MD5+Salt Passwords to MD5 in commercial application
Firstly, Do not save plain MD5 hashes in your database. Plain MD5 hashes can be reverse engineered quickly and easily using rainbow tables. However, here's how you solve your problem, no matter how you choose to store the passwords in the future:
Create a column in your new database that specifies the "version" of the password. This is used to determine if the password was generated ...
How to block sql injection and php shell uploaders using the htaccess file
As the topic sugests this is how to do it and it even blocks the lame huward script lol this is a good htaccess config file for noobs who have no idea on how to stop alot of these hacking techniques.
Beginning with Target PHP-based Instances of this series, we have covered all major attacks on Web applications and servers, with examples of vulnerable PHP code. In this article, we will cover those attacks that deal specifically with PHP, and ...







