<?php /* Envoi d'une requête POST sur le serveur https://secure.example.com/form_action.php * Inclusion des variables "foo" et "bar" */
$sock = fsockopen("ssl://secure.example.com", 443, $errno, $errstr, 30); if (!$sock) die("$errstr ($errno)\n");
$data = "foo=" . urlencode("Valeur de Foo") . "&bar=" . urlencode("Valeur de Bar");
fputs($sock, "POST /form_action.php HTTP/1.0\r\n"); fputs($sock, "Host: secure.example.com\r\n"); fputs($sock, "Content-type: application/x-www-url-encoded\r\n"); fputs($sock, "Content-length: " . strlen($data) . "\r\n"); fputs($sock, "Accept: */*\r\n"); fputs($sock, "\r\n"); fputs($sock, "$data\r\n"); fputs($sock, "\r\n");
$headers = ""; while ($str = trim(fgets($sock, 4096)))
color="#007700">($sock, 4096);
fclose($sock); ?>
|