久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      PHP中 fsockopen 函數(shù)怎么用?

      在PHP中fsockopen函數(shù)的作用是打開一個(gè)網(wǎng)絡(luò)連接或者一個(gè)Unix套接字連接,其語(yǔ)法為“fsockopen($hostname) ”,返回值為一個(gè)文件句柄,之后可以被其他文件類函數(shù)調(diào)用。

      PHP中 fsockopen 函數(shù)怎么用?

      簡(jiǎn)單示例

      <?php $fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if (!$fp) {     echo "$errstr ($errno)<br />n"; } else {     $out = "GET / HTTP/1.1rn";     $out .= "Host: www.example.comrn";     $out .= "Connection: Closernrn";     fwrite($fp, $out);     while (!feof($fp)) {         echo fgets($fp, 128);     }     fclose($fp); } ?>

      使用UDP連接

      <?php $fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr); if (!$fp) {     echo "ERROR: $errno - $errstr<br />n"; } else {     fwrite($fp, "n");     echo fread($fp, 26);     fclose($fp); } ?>

      使用示例

      <?php $host = "something.example.com"; $port = 443; $path = "/the/url/path/file.php"; //or .dll, etc. for authnet, etc.  //you will need to setup an array of fields to post with //then create the post string $formdata = array ( "x_field" => "somevalue"); //build the post string   foreach($formdata AS $key => $val){     $poststring .= urlencode($key) . "=" . urlencode($val) . "&";   } // strip off trailing ampersand $poststring = substr($poststring, 0, -1);  $fp = fsockopen("ssl://".$host, $port, $errno, $errstr, $timeout = 30);  if(!$fp){ //error tell us echo "$errstr ($errno)n";    }else{    //send the server request   fputs($fp, "POST $path HTTP/1.1rn");   fputs($fp, "Host: $hostrn");   fputs($fp, "Content-type: application/x-www-form-urlencodedrn");   fputs($fp, "Content-length: ".strlen($poststring)."rn");   fputs($fp, "Connection: closernrn");   fputs($fp, $poststring . "rnrn");    //loop through the response from the server   while(!feof($fp)) {     echo fgets($fp, 4096);   }   //close fp - we are done with it   fclose($fp); }

      推薦教程:《PHP》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)