PHP Classes

Minimal required functions

Recommend this page to a friend!

      PHP HTTP protocol client  >  All threads  >  Minimal required functions  >  (Un) Subscribe thread alerts  
Subject:Minimal required functions
Summary:Minimal required functions to get a webpage body via proxy
Messages:2
Author:Petar
Date:2007-10-27 09:26:11
Update:2007-10-27 18:35:31
 

  1. Minimal required functions   Reply   Report abuse  
Picture of Petar Petar - 2007-10-27 09:26:11
Hi,

There is a detailed example test_html.php. I just want to ask you about minimal required part of this example to get only the body of given webpage via transparent proxy.

$http=new http_class;
$url="http://www.google.com/";
$error=$http->GetRequestArguments($url,$arguments);
$arguments["ProxyHostName"]=$ip;
$arguments["ProxyHostPort"]=$port;
$arguments["ProxyUser"]="";
$arguments["ProxyPassword"]="";
$arguments["ProxyRealm"]="";
$arguments["ProxyWorkstation"]="";
$http->proxy_authentication_mechanism="";
$arguments["Headers"]["Pragma"]="nocache";
$error=$http->Open($arguments);
$error=$http->SendRequest($arguments);
$error=$http->ReadReplyHeaders($headers);
for(;;) {
$error=$http->ReadReplyBody($body,1000);
if($error!="" || strlen($body)==0) break;
echo HtmlSpecialChars($body);
}
echo "</PRE>\n";
$http->Close();

Are there any missing or extra no-necessary parts?

----

$http->timeout=10;
$http->data_timeout=1;

What does this mean? 10 sec, or ...? What is the difference between timewout and data_timeout?



  2. Re: Minimal required functions   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-10-27 18:35:32 - In reply to message 1 from Petar
Your code is sufficient. I just wonder if you have a transparent proxy you really need to explicitly use it with the class.

As for the timeout values they are independent . The main timeout values is for establish connections and the data_timeout is for waiting for responses from the server.