| Server IP : 64.202.187.69 / Your IP : 216.73.216.17 Web Server : Apache System : Linux 69.187.202.64.host.secureserver.net 3.10.0-1160.144.1.el7.tuxcare.els6.x86_64 #1 SMP Fri May 29 16:22:24 UTC 2026 x86_64 User : transmarket ( 1001) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/transmarket/testtranslator/ |
Upload File : |
<?php
echo "<h1>403 Forbidden</h1> ";
die();
include 'controllers/connection.php';
//ini_set('memory_limit', '-1');
$limit = isset($_GET['limit'])? $_GET['limit'] : '0';
$limit = $limit.",10";
echo "SQL ".$sql = 'SELECT * FROM `tbl_sentence` WHERE 1 and category_id = "87" AND is_lock = 0 AND suggestion_started_pending_at IS NULL AND voting_started_at IS NULL AND voting_closed_at IS NULL AND id>86990 order by id asc limit '.$limit;
/////// AND id>86990
//LAST SQL: SELECT * FROM `tbl_sentence` WHERE 1 and category_id = "87" AND is_lock = 0 AND suggestion_started_pending_at IS NULL AND voting_started_at IS NULL AND voting_closed_at IS NULL limit 900,200
echo "<br /><pre>";
$result = $mysqli->query($sql);
//$data = array();
$post = [
'source_lang' => 'English',
'target_lang' => 'Spanish',
];
$traslation_count =0;
while ($row = $result->fetch_object()) {
echo "<hr/> Count ". ++$traslation_count;
// print_r( $row );
//$post['source_text'] = $row->original_message;
$post['input_data'] = $row->original_message;
$ch = curl_init('http://169.255.36.158:5000/translate');
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json', 'accept' => 'application/json'));
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $post ) );
// execute!
$response = curl_exec($ch);
$response_obj = json_decode( $response );
//print_r( $response_obj );
//die();
////echo "<br />".
$rowID = $row->id;
$up = "update tbl_sentence set translated_message='{$response_obj->translated_text}' where id = '{$rowID}' limit 1 ";
if( $mysqli->query($up) ){
echo "<br />updated RowID". $rowID ;
}else{
echo "<br />NOT updated RowID". $rowID ." trying other method";
$up = 'update tbl_sentence set translated_message="'.$response_obj->translated_text.'" where id = "'.$rowID.'" limit 1 ';
/*if( $mysqli->query($up) ){
echo "<br />updated RowID in with doubl quote". $rowID ;
}else{
echo "<br />Failed to update the row ID ". $rowIDarr[] = $rowID;
}*/
}
// close the connection, release resources used
curl_close($ch);
// do anything you want with your response
////var_dump($response);
}
echo " Total failed rows ".print_r( $rowIDarr, true );