#! ./php -q
<?php


function PostToHost($host, $path, $referer, $data_to_send) {
	$fp = fsockopen($host, 80);
	printf("Open!\n");
	fputs($fp, "POST $path HTTP/1.1\r\n");
	fputs($fp, "Host: $host\r\n");
	fputs($fp, "Referer: $referer\r\n");
	fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
	fputs($fp, "Content-length: ". strlen($data_to_send) ."\r\n");
	fputs($fp, "Connection: close\r\n\r\n");
	fputs($fp, $data_to_send);
	printf("Sent!\n");
	while(!feof($fp)) {
		$res .= fgets($fp, 128);
	}
	printf("Done!\n");
	fclose($fp);

	return $res;
}


printf("Go!\n");
echo  PostToHost("mediadb.ivaya.de",	"/api.php?key=SCHLUESSEA&action=SetData&Tabelle=Filme",	"",	"imdbID=0398286&3d=&Gesehen=ja" ).PHP_EOL.PHP_EOL;
echo  PostToHost("mediadb.ivaya.de",	"/api.php?key=SCHLUESSEA&action=SetData&Tabelle=Filme",	"",	"imdbID=0398286&3d=&Gesehen=ja&checked=0&comment=Bildfehler"  ).PHP_EOL.PHP_EOL;

//http://mediadb.ivaya.de/api.php?key=0123456789&action=GetDataList&Tabelle=Serien&Spalten=Statistik