1. Question:Explain the parameters of PHP’s mail function. 

    Answer

    The PHP mail() function is used to send emails from inside a script.

    Prototype:

    boolean mail(string to, string subject, string message [, string addl_headers [, string addl_params]])

    ParameterDescription
    toRequired. Specifies the receiver / receivers of the email
    subjectRequired. Specifies the subject of the email. Note: This parameter cannot contain any newline characters
    messageRequired. Defines the message to be sent. Each line should be separated with a LF (\n). Lines should not exceed 70 characters
    headersOptional. Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (\r\n)
    parametersOptional. Specifies an additional parameter to the sendmail program


    Example:

    <?php
      
        mail("client@example.com","This is a subject","This is the mail body","from:admin@example.com\r\n");

    ?>






    1. Report
  2. Question:How does the session data store in computer? 

    Answer
    Session data can be stored in four ways: 
    1. Within flat failes (files),
    2. Within volatile memory (mm),
    3. Using the SQLite database (sqlite), or
    4. Through user-defined functions (user).






    1. Report
  3. Question:Name five internet services that commonly operates on a particular communications port. 

    Answer
    1. HTTP - Hyper Text Transfer Protocol
    2. FTP - File Transfer Protocol
    3. POP3 - Post Office Protocol
    4. IMAP - Internet Message Access Protocol
    5. SSH - Secure SHell






    1. Report
  4. Question:How do you retrive internet service port number in php? 

    Answer
    The getservbyname() function returns the port number of a specified service.

    Prototype:

    int getservbyname(string service, string protocol)

    Example:

    <?php
       echo "HTTP's default port number is: ".getservbyname("http","tcp");

    ?>






    1. Report
  5. Question:How do you get a socket connection in php? 

    Answer
    The fsocketopen() function establishes a connection to the resource designated by target on port.

    Prototype:

    resource fsockopen( string target, int port [, int erron [, string errsting [, float timeout]]])

    Example:

    <?php
       $http=fsockopen("www.example.com",80);
     
       $req="GET / HTTP/1.1\r\n";
       $req.="Host: www.example.com\r\n";
       $req.="Connection: Close\r\n\r\n";

      fputs($http,$req);
     
      while(!feof($http)){

          echo fgets($http,1024);

       }
    fclose($http);
     
    ?>






    1. Report
Copyright © 2025. Powered by Intellect Software Ltd