function SubmitPlagAwareTestText($userCode,
$resultUrl,
$testText,
$reportName=null,
$reportComment=null,
$projectId=null,
$dryRun=false)
{
$host = “www.plagaware.de”;
$port = 80;
$path = “/service/submittext”;
$postdata = array(‘UserCode’=>$userCode,
‘ResultUrl’=>$resultUrl,
‘TestText’=>$testText,
‘ReportName’=>$reportName,
‘ReportComment’=>$reportComment,
‘ProjectId’=>$projectId,
‘DryRun’=>$dryRun);
$data = “”;
$boundary = “———————“.substr(md5(rand(0,32000)),0,10);
$fp = fsockopen($host, $port);
fputs($fp, “POST $path HTTP/1.0\n”);
fputs($fp, “Host: $host\n”);
fputs($fp, “Content-type: multipart/form-data; boundary=”.$boundary.”\n”);
foreach($postdata as $key => $val){
$data .= “–$boundary\n”;
$data .= “Content-Disposition: form-data; name=\””.$key.”\”\n\n”.$val.”\n”;
}
$data .= “–$boundary\n”;
fputs($fp, “Content-length: “.strlen($data).”\n\n”);
fputs($fp, $data);
while(!feof($fp)) {
$res .= fread($fp, 1);
}
fclose($fp);
return $res;
}