偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

詳解PHP fsockopen的使用方法

開發(fā) 后端
PHP fsockopen函數(shù)對于我們剛剛接觸PHP語言的人來說,還是不太了解其具體功能。希望通過本文介紹的內(nèi)容能對大家起到一定的幫助。

PHP fsockopen是一個功能比較強(qiáng)大的函數(shù)。我們在這篇文章中將會對這個函數(shù)做一個具體的介紹,希望對大家有所幫助。記得以前的B2C網(wǎng)站就是通過這個函數(shù)實(shí)現(xiàn)前臺和訂單處理系統(tǒng)的交互。#t#

還有一個以curl_開頭的函數(shù),可以實(shí)現(xiàn)很多功能。有時間要好好研究!下面是關(guān)于fscokopen的介紹

 

1.PHP fsockopen函數(shù)說明:

Open Internet or Unix domain socket connection(打開套接字鏈接)

Initiates a socket connection to the resource specified by target .

fsockopen() returns a file pointer which may be used together with the other file functions (such as fgets() , fgetss() , fwrite() , fclose() , and feof() ).就是返回一個文件句柄

開啟PHP fsockopen這個函數(shù)

PHP fsockopen需要 PHP.ini 中 allow_url_fopen 選項(xiàng)開啟。
 

  1. $fp = fsockopen("www.example.com",
     80, $errno, $errstr, 30);   
  2. if (!$fp) {   
  3. echo "$errstr ($errno)<br />\n";   
  4. } else {   
  5. $out = "GET / HTTP/1.1\r\n";   
  6. $out ."Host: www.example.com\r\n";   
  7. $out ."Connection: Close\r\n\r\n";   
  8.  
  9. fwrite($fp, $out);   
  10. while (!feof($fp)) {   
  11. echo fgets($fp, 128);   
  12. }   
  13. fclose($fp);   
  14. }  

以上就是PHP fsockopen函數(shù)的具體使用方法,供大家參考學(xué)習(xí)。

責(zé)任編輯:曹凱 來源: 網(wǎng)易博客
相關(guān)推薦

2009-11-30 17:43:54

PHP split()

2009-12-02 18:51:12

PHP分頁類

2011-06-16 11:01:56

PHP繼承

2009-12-07 16:52:59

PHP函數(shù)getima

2009-12-28 13:28:03

WPF視頻

2009-11-17 17:38:37

PHP Session

2009-12-02 15:02:09

PHP simplex

2009-08-25 16:54:28

C# RichText

2009-11-24 15:50:09

PHP上傳類uploa

2011-07-12 17:11:13

PHPSHELL

2009-11-24 19:25:32

PHP關(guān)聯(lián)數(shù)組

2009-11-26 19:05:04

PHP函數(shù)explod

2009-11-26 15:23:24

PHP函數(shù)ereg()

2009-12-01 17:00:49

PHP變量

2009-12-02 14:50:25

PHP接口類inter

2009-11-25 10:02:27

PHP會話Sessio

2010-06-01 19:55:30

SVN使用

2010-06-03 17:38:03

Hadoop命令

2010-01-28 17:07:03

Android Gal

2010-10-09 10:30:03

JS event
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號