4번독수리의 둥지

check max get parameter length with PHP+cURL 본문

PHP

check max get parameter length with PHP+cURL

4번독수리 2015. 10. 20. 13:27

<?php
$status = '';
for ( $len = 2000; $status != '414'; $len+=10 ) {
 $status = execute($len);
}
echo $len, "\n";
exit;

function execute( $len ) {
 // 10*n length url
 $url = 'http://example.com?abcdefghijk=1';
 $i = 0;
 do {
  // 10 length get parameter
  $url.= '&a'.str_pad("$i", 6, '0').'=1';
  $i++;
 } while ( strlen($url)+10 <= $len );
 
 $ch = curl_init($url);
 curl_setopt_array($ch, array(
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_HEADER => true
 ));
 curl_exec($ch);
 $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
 curl_close($ch);
 
 return $status;
}

* 남의 서버를 공격하지 맙시다..

'PHP' 카테고리의 다른 글

PHP memory management  (0) 2015.11.30
Downgrading a PECL Module  (0) 2015.11.02
Quickly Removing Empty Array Elements in PHP  (0) 2015.04.28
빠른 array_unique()  (0) 2015.04.28
php $_POST  (0) 2014.09.26