Premetto che con php e' la prima volta che ho a che fare!
Sto scrivendo uno script che legge una pagina html e ne analizza il contenuto, il problema e' che quando leggo il contenuto la variabile che sto usando $buffer arriva fino a 1024 caratteri dopodiche' non ne mette altri (verificato con xdebug, sto lavorando in eclipse) e non genera neanche nessun'errore (flag di errore in php.ini settato su E_ALL).
Credo che sia un problema della mia installazione di php (Ho usato wamp 2.1), a quanto ho letto in giro le stringhe non dovrebbero avere limitazioni di lunghezza (ram a parte naturalmente)
Incollo qui il codice della funzione che dovrebbe leggere l'html
Codice PHP:
require('httpclient/http.php');
function get_html_file($url, $cookie, $method, $values) {
$buffer = "";
if (!isset($method))
$method='GET';
set_time_limit(0);
$http=new http_class;
$http->timeout=0;
$http->data_timeout=0;
$http->debug=0;
$http->html_debug=0;
$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=1;
$error=$http->GetRequestArguments($url, $arguments);
$arguments["Headers"]["Pragma"]="nocache";
$arguments["RequestMethod"]=$method;
if ($method=='POST'){
$arguments["PostValues"]=$values;
}
if (isset($cookie)){
$cookie_name=$cookie['name'];
$cookie_value=$cookie['value'];
$cookie_expires=""; // "" for session cookies
$cookie_uri_path="/";
$cookie_domain=$cookie['domain'];
$cookie_secure=0; // 1 for SSL only cookies
$http->SetCookie($cookie_name, $cookie_value, $cookie_expiry, $cookie_uri_path, $cookie_domain, $cookie_secure);
}
$error=$http->Open($arguments);
if($error=="") {
$error=$http->SendRequest($arguments);
if($error=="") {
for(;;) {
$error=$http->ReadReplyBody($body, 1000);
if($error!="" || strlen($body)==0)
break;
$buffer .= $body;
}
}
$http->Close();
}
return $buffer;
}
Prima di provare con questo codice avevo provato a leggere la pagina con file_get_contents() pero' il problema non cambia