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
Solved

connect to Whois server via proxy  and proxy chaining

Posted on 2006-07-07
13
3,782 Views
Last Modified: 2012-06-27
Hello experts
My first question here :)
The following code from
http://de2.php.net/manual/de/function.fopen.php#53090
Should  get the continent of a page via proxy  ( I have not tried but it should be fine )
<?php
function proxy_url($proxy_url)
{
   $proxy_name = '127.0.0.1';
   $proxy_port = 4001;
   $proxy_user = "user";    // added
   $proxy_pass = "password";    // added
   $proxy_cont = '';

   $proxy_fp = fsockopen($proxy_name, $proxy_port);
   if (!$proxy_fp)    {return false;}
   fputs($proxy_fp, "GET $proxy_url HTTP/1.0\r\nHost: $proxy_name\r\n");
   fputs($proxy_fp, "Proxy-Authorization: Basic " . base64_encode ("$proxy_user:$proxy_pass") . "\r\n\r\n");    // added
   while(!feof($proxy_fp)) {$proxy_cont .= fread($proxy_fp,4096);}
   fclose($proxy_fp);
   $proxy_cont = substr($proxy_cont, strpos($proxy_cont,"\r\n\r\n")+4);
   return $proxy_cont;
}
?>


The following code from
http://www.zend.com/zend/spotlight/connecting.php
 ( I have not tried but it should be fine )

function lookup($lookup){  
            $whois = "whois.geektools.com";  
            $fp = fsockopen($whois, 43, &$errno, &$errstr, 30);  
            if (!$fp){  
                printf("Error: %s (%s)", $errstr, $errno);  
                $data = 0;  
            } else {  
                $lookup .= "\n";  
                fputs($fp, $lookup);  
                $data = fread( $fp, 16384 );  
                fclose($fp);  
            }  
            return $data;  
        }  

should connect to whois and gives the whois result ( I have not tried but it should be fine )

Now my questions
say I have two proxy servers
proxy1  111.111.111.111:8080
proxy2   222.222.222.222:80

1-How to connect to whois server via proxy ( the script connects to proxy1 then proxy1 connect to the whois server and get the result )
2- How to do proxy chaining  ( the script connect to proxy1 then proxy1 connects to proxy2 then get the result from msn.com  for example )
3- How to do proxy chaining to connect to whois server ( the script connect to proxy1 then proxy1 connects to proxy2 then get the result from whois server  )

Please provide complete code
Thank you in advance
 
0
Comment
Question by:honestman31
  • 5
  • 3
  • 2
  • +1
13 Comments
 
LVL 10

Author Comment

by:honestman31
ID: 17066680
Hello experts .
Are my questions difficult or do you need more clarification ?
Please let me know
0
 
LVL 24

Expert Comment

by:slyong
ID: 17078692
Proxy chaining is more of a network issue then PHP issue.  So if you are doing [ workstation --> proxy1 --> proxy2 --> Web Server ] connection, you need to setup the proxy chain from proxy1 --> proxy2 first.  There is nothing to do with the PHP script.
0
 
LVL 10

Author Comment

by:honestman31
ID: 17078833
slyong ,
Do you mean Proxy chaining  cannot be done in PHP ?
Also what about connecting to whois via proxy ? cannot be done in PHP too?
Thank you
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
LVL 24

Expert Comment

by:slyong
ID: 17079227
honestman31,

Yes proxy chaining is not to be done on PHP, it can be done in PHP but it is a huge proxy hacking through sockets and things like that.  There is a PHP proxy implementation here: http://sourceforge.net/project/showfiles.php?group_id=52440.  You can also do use other proxy chaining tools like:

http://www.security.nnov.ru/soft/3proxy/
and
http://proxychains.sourceforge.net/

To connect to whois via proxy can be done in PHP with Curl extension:

The code example can be found here http://au2.php.net/manual/en/ref.curl.php
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17079925
What OS are you using?
0
 
LVL 10

Author Comment

by:honestman31
ID: 17080065
I use windows xp sp2 ( PHP Version 4.3.11 )
and also I have shared hosting uses linux (PHP Version 4.4.2)
Thanks
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17080100
I was asking, because it might be easier to use an external program (like whois on linux).
If you call it with exec() in PHP you can 'catch' the output for use in your PHP script
0
 
LVL 10

Author Comment

by:honestman31
ID: 17080166
I cannot install any program on my shared hosting.
My problem is that I provide whois look up in my site after some queries the whois server will block the server IP for a one day  , So I was thinking to query whois via proxies . and even I want to make it more efficient by using  proxy chaining
Thanks
0
 
LVL 1

Accepted Solution

by:
smackadoo earned 500 total points
ID: 17201969
of course they will block your server ip.
People running whoiservers pay to run their whois queries and don't allow people to hijack their websites, sucking their bandwidth so you can show it to users on your site (probably making money by showing ads aswell)

Instead of showing their information on your pages, link to their site where they can see the information on their pages.

I'd expect if the whois sites spotted you were abusing their webpages by proxy or by other means, some of them have been known to send a lawyers letter with a bill for all the bandwidth you have used) (eg DnsStuff.com)
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17202184
Good point :)
0
 
LVL 10

Author Comment

by:honestman31
ID: 17371227
I have not accepted this answer nor I recieved a notification of the Administrative Comment  dated  08/19/2006 11:45AM PDT,
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
selector:validator cookies 4 30
PHP alternative to file_get_contents('php://input') 4 60
JQuery Search Filter 2 28
$_SERVER Variable question 31 27
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

839 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