hartabergerecht on Sat, 6 Dec 2003 00:04:06 +0100 (CET) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
[rohrpost] hartabergerecht.php |
<?php $repeat = 100; // How many times repeat the test $timeout = 100; // Max time for stablish the conection $size = 0; // Bytes will be read (and display). 0 for read all $server = '80.237.130.39'; // IP address $host = 'www.hartundgerecht.de'; // Domain name $target = '/index.php?id=15'; // Specific program $referer = 'http://www.hartundgerecht.de/index.php?id=14'; // Referer $port = 80; // Setup an array of fields to get with then create the get string // $gets = array ( 'get_field_1' => 'somevalue', // 'get_field_2' => 'somevalue' ); // Setup an array of fields to post with then create the post string $posts = array ( 'Text1' => 'HART ABER GERECHT', 'Text2' => 'info@hartabergerecht.de', 'Text3' => 'HART ABER GERECHT', 'Text4' => 'info@hartabergerecht.de', 'Textarea1' => 'HART ABER GERECHT' ); // That's all. Now the program proccess $repeat times $method = "GET"; if ( is_array( $gets ) ) { $getValues = '?'; foreach( $gets AS $name => $value ){ $getValues .= urlencode( $name ) . "=" . urlencode( $value ) . '&'; } $getValues = substr( $getValues, 0, -1 ); } else { $getValues = ''; } if ( is_array( $posts ) ) { foreach( $posts AS $name => $value ){ $postValues .= urlencode( $name ) . "=" . urlencode( $value ) . '&'; } $postValues = substr( $postValues, 0, -1 ); $method = "POST"; } else { $postValues = ''; } $request = "$method $target$getValues HTTP/1.1\r\n"; $request .= "Host: $host\r\n"; $request .= 'User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) '; $request .= "Gecko/20021204\r\n"; $request .= 'Accept: text/xml,application/xml,application/xhtml+xml,'; $request .= 'text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,'; $request .= "image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1\r\n"; $request .= "Accept-Language: en-us, en;q=0.50\r\n"; $request .= "Accept-Encoding: gzip, deflate, compress;q=0.9\r\n"; $request .= "Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66\r\n"; $request .= "Keep-Alive: 300\r\n"; $request .= "Connection: keep-alive\r\n"; $request .= "Referer: $referer\r\n"; $request .= "Cache-Control: max-age=0\r\n"; if ( $method == "POST" ) { $lenght = strlen( $postValues ); $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; $request .= "Content-Length: $lenght\r\n"; $request .= "\r\n"; $request .= $postValues; } for ( $i = 0; $i < $repeat; $i++ ) { $socket = fsockopen( $server, $port, $errno, $errstr, $timeout ); fputs( $socket, $request ); if ( $size > 0 ) { $ret = fgets( $socket, $size ); } else { $ret = ''; while ( !feof( $socket ) ) { $ret .= fgets( $socket, 4096 ); } } fclose( $socket ); echo "<hr> $i -- $content $ret"; flush(); } ?>
------------------------------------------------------- rohrpost - deutschsprachige Liste zur Kultur digitaler Medien und Netze Archiv: http://www.nettime.org/rohrpost http://post.openoffice.de/pipermail/rohrpost/ Ent/Subskribieren: http://post.openoffice.de/cgi-bin/mailman/listinfo/rohrpost/