Detailed instructions for using PHP fsockopen _php Tutorial

Source: Internet
Author: User

There is also a function that begins with Curl_, which allows for many functions. Have time to study well! Here is an introduction to Fscokopen

1.PHP fsockopen Function Description:

Open Internet or Unix domain socket connection (opens socket link)

Initiates a socket connection to the resource specified by target.

Fsockopen () Returns a file pointer which may is used together with the other file functions (such as fgets (), FGETSS (), Fwrite (), fclose (), and feof ()). is to return a file handle

Open PHP Fsockopen This function

PHP Fsockopen requires the php.ini allow_url_fopen option to open.

 
 
  1. $ FP = Fsockopen ("www.example.com",
    $errno, $ERRSTR, 30);
  2. if (! $fp) {
  3. echo "$errstr ($errno) < BR />n ";
  4. } else {
  5. $ out = "Get/http/1.1rn" ;
  6. $out . = "HOST:WWW.EXAMPLE.COMRN" ;
  7. $out . = "Connection:closernrn" ;
  8. Fwrite ($fp, $out);
  9. while (!feof ($fp)) {
  10. Echo fgets ($FP, 128);
  11. }
  12. Fclose ($FP);
  13. }

The above is the specific use of PHP fsockopen function, for everyone to reference the study.


http://www.bkjia.com/PHPjc/446176.html www.bkjia.com true http://www.bkjia.com/PHPjc/446176.html techarticle There is also a function that begins with Curl_, which allows for many functions. Have time to study well! Here is an introduction to Fscokopen 1.PHP fsockopen function Description: Open Internet or Unix d ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.