Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Jak udawac przegladarke
Forum PHP.pl > Forum > PHP
shl
Co nalezy i jak zglosic by skrypt ktory wchodzi na jaks strone udawal przegladarke ? Naglowki ale jakie i z czym sie to je ? Gdzie szukac czegos na ten temat ? Moze jakies wzorce do podpatrzenia ?
dr_bonzo
http://snoopy.sourceforge.net/
hwao
fsockopen" title="Zobacz w manualu PHP" target="_manual()
Szczegulnie kometarze

  1. <?php
  2. $repeat = 100; // How many times repeat the test
  3.  
  4. $timeout = 100; // Max time for stablish the conection
  5. $size = 16; // Bytes will be read (and display). 0 for read all
  6.  
  7. $server = '64.246.30.37'; // IP address
  8. $host = 'www.foo.com'; // Domain name
  9. $target = '/poll/answer.asp'; // Specific program
  10. $referer = 'http://www.test.com/'; // Referer
  11. $port = 80;
  12.  
  13. // Setup an array of fields to get with then create the get string
  14. $gets = array ( 'get_field_1' => 'somevalue',
  15.  'get_field_2' => 'somevalue' );
  16.  
  17. // Setup an array of fields to post with then create the post string
  18. $posts = array ( 'post_field_1' => 'somevalue',
  19.  'post_field_2' => 'somevalue' );
  20.  
  21. // That's all. Now the program proccess $repeat times
  22.  
  23. $method = &#092;"GET\";
  24. if ( is_array( $gets ) ) {
  25.  $getValues = '?';
  26.  foreach( $gets AS $name => $value ){
  27.  $getValues .= urlencode( $name ) . &#092;"=\" . urlencode( $value ) . '&';
  28.  }
  29.  $getValues = substr( $getValues, 0, -);
  30. } else {
  31.  $getValues = '';
  32. }
  33.  
  34. if ( is_array( $posts ) ) {
  35.  foreach( $posts AS $name => $value ){
  36.  $postValues .= urlencode( $name ) . &#092;"=\" . urlencode( $value ) . '&';
  37.  }
  38.  $postValues = substr( $postValues, 0, -);
  39.  $method = &#092;"POST\";
  40. } else {
  41.  $postValues = '';
  42. }
  43.  
  44. $request = &#092;"$method $target$getValues HTTP/1.1rn\";
  45. $request .= &#092;"Host: $hostrn\";
  46. $request .= 'User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) ';
  47. $request .= &#092;"Gecko/20021204rn\";
  48. $request .= 'Accept: text/xml,application/xml,application/xhtml+xml,';
  49. $request .= 'text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,';
  50. $request .= &#092;"image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1rn\";
  51. $request .= &#092;"Accept-Language: en-us, en;q=0.50rn\";
  52. $request .= &#092;"Accept-Encoding: gzip, deflate, compress;q=0.9rn\";
  53. $request .= &#092;"Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66rn\";
  54. $request .= &#092;"Keep-Alive: 300rn\";
  55. $request .= &#092;"Connection: keep-alivern\";
  56. $request .= &#092;"Referer: $refererrn\";
  57. $request .= &#092;"Cache-Control: max-age=0rn\";
  58.  
  59. if ( $method == &#092;"POST\" ) {
  60.  $lenght = strlen( $postValues );
  61.  $request .= &#092;"Content-Type: application/x-www-form-urlencodedrn\";
  62.  $request .= &#092;"Content-Length: $lenghtrn\";
  63.  $request .= &#092;"rn\";
  64.  $request .= $postValues;
  65. }
  66.  
  67. for ( $i = 0; $i < $repeat; $i++ ) {
  68.  $socket = fsockopen( $server, $port, $errno, $errstr, $timeout );
  69.  fputs( $socket, $request );
  70.  if ( $size > 0 ) {
  71.  $ret = fgets( $socket, $size );
  72.  } else {
  73.  $ret = '';
  74.  while ( !feof( $socket ) ) {
  75.  $ret .= fgets( $socket, 4096 );
  76.  }
  77.  }
  78.  fclose( $socket );
  79.  echo &#092;"<hr> $i -- $content $ret\";
  80. }
  81. ?>
Spirit86
np. tak:
  1. <?php
  2. ini_set('user_agent','MSIE 4.0b2;'); 
  3. ?>


Musisz mieć uprawnienia do używania tej funkcji. (jest wyłaczona chyba przy SAFE_MODE=ON)
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.