PHP Classes

memory leak ?

Recommend this page to a friend!

      PHP HTTP protocol client  >  All threads  >  memory leak ?  >  (Un) Subscribe thread alerts  
Subject:memory leak ?
Summary:?
Messages:2
Author:vMyth
Date:2008-04-29 13:03:44
Update:2008-04-29 18:21:39
 

  1. memory leak ?   Reply   Report abuse  
Picture of vMyth vMyth - 2008-04-29 13:03:47
<?
require("http.php");

function get_html($url, $array = "") {
$http = new http_class;
$http->follow_redirect = 1;
$http->debug = 0;
$http->debug_response_body = 0;
$http->html_debug = 1;
$http->user_agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
$http->follow_redirect=1;
$http->redirection_limit=5;
$http->exclude_address="";
$http->prefer_curl=0;

$error=$http->Open($arguments);
if($error=="") {
$error=$http->SendRequest($arguments);
if($error=="") {
$headers=array();
$error=$http->ReadReplyHeaders($headers);
if($error=="") {
for(;;) { $error=$http->ReadReplyBody($body,1000);
}
}
}
$http->Close();
}
if(strlen($error)) {
return false;
} else {
return $body;
}
}

echo get_html("http://www.google.com");
?>

I'm about creating a simple function to get page HTML but it always raise the number of Apache processes in my computer to 50 or 100. Can you tell me why please ? Thanks.

  2. Re: memory leak ?   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-04-29 18:21:40 - In reply to message 1 from vMyth
I am not sure what you mean.

Anyway, it seems that you are not setting the arguments array anywhere, so that script should not do what you want.