1. Advertiser uploads the banner inside the admin area.
2. Advertiser decides where (on what domain) to advertise.
3. System must copy the banner to the required domains
4. Banner is served from the domains
I am wondering how to best move the pictures over to the other server when I might not know the ftp user and pass.
My second thought was to to output the binary data as text and fetch it from the other server but this seems top be like a bad idea due to possible encoding limitations.
My second thought is to use a post request described here http://www.php-faq.de/q-code-post.html (in German)
Code: Select all
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;
}
$data = "pid=14&poll_vote_number=2";
printf("Go!\n");
$x = PostToHost(
"www.linux.com",
"/polls/index.phtml",
"http://www.linux.com/polls/index.phtml?pid=14",
$data
);