phpbar.de logo

Mailinglisten-Archive

[php] Nach POST einer redirecteten URL folgen?

[php] Nach POST einer redirecteten URL folgen?

Mailanbecker php_(at)_phpcenter.de
Fri, 13 Apr 2001 22:47:23 -0700


----- Original Message ----- 
From: "Christoph Hoenig" <mail_(at)_christoph-hoenig.de>

Ich glaub du suchst so etwas:

function PostToHost($host, $path, $referer, $data_to_send) {
  $fp = fsockopen($host,80);
  printf("Open!\n");
  fputs($fp, "POST $path HTTP/1.1\n");
  fputs($fp, "Host: $host\n");
  fputs($fp, "Referer: $referer\n");
  fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
  fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
  fputs($fp, "Connection: close\n\n");
  fputs($fp, "$data_to_send\n");
  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
);




php::bar PHP Wiki   -   Listenarchive