View Single Post
Old 04-21-2005, 03:28 PM   #4
vodevil
Green Mole
 
Join Date: Mar 2005
Posts: 11
Angry

I have modifieed this function :


Quote:
//=================================================
//store a content_text from a spider_id
function phpdigWriteText($relative_script_path,$spider_id,$text,$ftp_id='') {
global $br;
if (CONTENT_TEXT == 1) {

$file_text_path = $relative_script_path.'/'.TEXT_CONTENT_PATH.$spider_id.'.txt';
if ($f_handler = @fopen($file_text_path,'w')) {
reset($text);
while (list($n_chunk,$text_to_store) = each($text)) {
fputs($f_handler,wordwrap($text_to_store));
}
fclose($f_handler);
@chmod($file_text_path,0666);
//here the ftp case
if (FTP_ENABLE) {
$ftp_id = phpdigFtpKeepAlive($ftp_id);
@ftp_delete($ftp_id,$spider_id.'.txt');
$res_ftp = false;
$try_count = 0;
while (!$res_ftp && $try_count++ < 10) {
$res_ftp = @ftp_put($ftp_id,$spider_id.'.txt',$file_text_path,FTP_ASCII);
if (!$res_ftp) {
sleep(2);
}
}
if (!$res_ftp) {
print "Ftp_put error !".$br;
}

}
}
else {
print "Warning : Unable to create the content file $file_text_path ! $br";
}
}
return $ftp_id;
}

By this :

Quote:
//=================================================
//store a content_text from a spider_id
function phpdigWriteText($relative_script_path,$spider_id,$text,$ftp_id='') {
global $br;
if (CONTENT_TEXT == 1) {


while (list($n_chunk,$text_to_store) = each($text)) {
fputs($f_handler,wordwrap($text_to_store));
}

$requete = "INSERT INTO text_content VALUES ('$spider_id','$text_to_store')";


$query = mysql_query($requete) or die(mysql_error);

}


}
This modification no cause error but phpdig doesn't store information into Mysql
vodevil is offline   Reply With Quote