Gumbo
Erfahrenes Mitglied
Probier mal Folgendes:
PHP:
function post($url, $query)
{
$parts = parse_url($url);
$requestURL = $parts['path'];
if( !empty($parts['query']) ) {
$requestURL .= '?'.$parts['query'];
}
$request = 'POST '.$requestURL.' HTTP/1.1' . "\r\n";
$headerFields = array(
'Host' => $parts['host'],
'Content-Type' => 'application/x-www-form-urlencoded',
'Connection' => 'close'
);
foreach( $headerFields as $fieldName => $fieldValue ) {
$request .= $fieldName.': '.$fieldValue . "\r\n";
}
$request .= "\r\n" . $query;
$fp = fsockopen($host, empty($parts['port']) ? $parts['port'] : 80);
fwrite($fp, $request);
while( !feof($fp) ) {
$response .= fgets($fp, 128);
}
fclose($fp);
return $response;
}