wcypierre

tbd shoutbox2

Oct 18th, 2011
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.24 KB | None | 0 0
  1. <?php
  2.  
  3. set_time_limit(0);
  4. ini_set('memory_limit','128M');
  5. ini_set('xdebug.max_nesting_level', 0);
  6. ini_set('implicit_flush',1);
  7.  
  8. function listen($host, $port, $data_arr) {
  9.     ob_start();
  10.     $header = array(
  11.         //"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0\r\n",
  12.         //"Accept:    text/plain, */*; q=0.01\r\n",
  13.         //"Accept-Language:    en-us,en;q=0.5\r\n",
  14.         //"Accept-Encoding: gzip, deflate\r\n",
  15.         //"Accept-Charset:    ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n",
  16.         "Connection:keep-alive\r\n",
  17.         "X-Requested-With:XMLHttpRequest\r\n",
  18.         "If-None-Match:0\r\n",
  19.         "If-Modified-Since:".gmdate("r", time())."\r\n\r\n");      
  20.        
  21.     $url = $host . "/sub?id=tbdshout&a=d4257aa2d6c95fca201b173a7c35d87e26aeeaae";
  22.        
  23.     $opts = array(
  24.     CURLOPT_URL => $url,
  25.     CURLOPT_RETURNTRANSFER => true,
  26.     CURLOPT_FOLLOWLOCATION => false,
  27.     //CURLOPT_USERAGENT => $useragent,
  28.     /*CURLOPT_PROXY => "10.1.1.71",
  29.     CURLOPT_PROXYPORT => 8080,*/
  30.     CURLOPT_HEADER => false,
  31.     CURLOPT_PORT => $port,
  32.     CURLOPT_HTTPHEADER => $header,
  33.     //CURLOPT_POSTFIELDS => 'A',
  34.     CURLOPT_SSL_VERIFYPEER => false,
  35.     CURLOPT_SSL_VERIFYHOST => 2,
  36.     CURLOPT_HTTPAUTH => CURLAUTH_ANY);
  37.  
  38.     $init = curl_init();
  39.     curl_setopt_array($init,$opts);
  40.    
  41.     $exec = curl_exec($init);
  42.    
  43.     $data = json_decode($exec);
  44.     var_dump($data);
  45.    
  46.     /*
  47.     if(isset($data_arr))
  48.     {
  49.         $count = count($data_arr);
  50.         var_dump($count);  
  51.        
  52.         if($count == 0 or $count == 1){
  53.             echo "<b>". $count . "</b>";
  54.             if($data_arr[$count-1] == null){
  55.                 $data_arr[$count-1] = $data->shout_msg;
  56.                 echo $data_arr[$count-1];
  57.                 ob_flush();
  58.                 flush();
  59.             }
  60.         }
  61.         else if(isset($data_arr[$count]) != isset($data_arr[$count+1])){
  62.                 $data_arr[$count] = $data->shout_msg;
  63.                 echo $data_arr[$count]. "<br />";
  64.                 //var_dump($data_arr);
  65.        
  66.                 ob_flush();
  67.                 flush();               
  68.         }
  69.     }*/
  70.    
  71.     //echo $data->uname . " -> " . $data->shout_msg . "<br />";
  72.    
  73.     curl_close($init);
  74.    
  75.     //sleep(5);
  76.     unset($host, $port, $header, $opts, $init, $exec);
  77.     ob_end_flush();
  78.     listen($_GET['host'],"8080",$data_arr);
  79.    
  80.     //http://w3.tbd.my/xmlhttp.php?action=show_shouts_json&jsoncallback=?
  81. }
  82.  
  83. function latest_listen(){
  84.  
  85. }
  86.  
  87. $_GET['host'] = "s.tbd.my";
  88. $lhost = $_GET['host'];
  89.  
  90. listen($lhost,"8080",'');
  91.    
  92. ?>
  93.  
Advertisement
Add Comment
Please, Sign In to add comment