User Tools

Site Tools


uphp:functions:fsockopen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp:functions:fsockopen [2017/04/06 12:02]
jeff
uphp:functions:fsockopen [2021/09/13 05:57] (current)
Line 7: Line 7:
 ====Description==== ====Description====
  
-<well size="sm"> +<well size="sm"><html>
-<html>+
 <span style="font-size:125%;color:green">int <span style="font-size:125%;color:green">int
-<span style="color:black"> +<span style="color:black">fsockopen (
-</html> +
-[[fsockopen]] ( +
-<html>+
 <span style="color:green">string <span style="color:green">string
 <span style="color:blue">$host<span style="color:black">, <span style="color:blue">$host<span style="color:black">,
Line 22: Line 18:
 <span style="color:blue">$timeout <span style="color:blue">$timeout
 <span style="color:black">] ) <span style="color:black">] )
-</html> +</html></well>
-</well>+
  
 Attempts to create a socket to a remote host using the protocol specified, and return the file handle for future operations. By default a TCP/IP connection will be initiated. If a UDP connection is required prefix the host name with udp:%%//%% (lower case). The socket will be opened in blocking mode. Attempts to create a socket to a remote host using the protocol specified, and return the file handle for future operations. By default a TCP/IP connection will be initiated. If a UDP connection is required prefix the host name with udp:%%//%% (lower case). The socket will be opened in blocking mode.
Line 33: Line 28:
 <html><b><span style="color:blue">$port<span style="color:black"></b></html>:  Port number <html><b><span style="color:blue">$port<span style="color:black"></b></html>:  Port number
  
-<html><b><span style="color:blue">$timeout<span style="color:black"></b></html>:  Connection timeout in seconds, optional (if not specified the system wide setting in [[os:config:uphp.ini]] will be used).+<html><b><span style="color:blue">$timeout<span style="color:black"></b></html>:  Connection timeout in seconds, optional (if not specified the system wide setting in [[software:os:config:uphp.ini]] will be used).
  
-====Return Value====+====Return Values====
  
-Upon success it returns a file handle which may be used together with the other file functions that require a handle such as [[fgets()]][[fwrite()]], [[fclose()]] and [[feof()]] +<html><b><span style="color:green">Integer<span style="color:black"></b></html>:  File handle, or 0 if the attempt to open the connection fails
- +
-If the attempt to open the connection fails it will return 0+
  
 +The file handle may be used together with the other file functions that require a handle such as [[fgets()]], [[fwrite()]], [[fclose()]] and [[feof()]]
  
 ====Example==== ====Example====
  
-**Create a connection to www.example.com and display the response:**+===Create a connection to www.example.com and display the response===
  
 <code php> <code php>
Line 64: Line 58:
 </code> </code>
  
-====See Also====+====Also See====
  
 [[fopen()]] - Open a file for reading or writing [[fopen()]] - Open a file for reading or writing
uphp/functions/fsockopen.1491480172.txt.gz · Last modified: 2021/09/13 05:56 (external edit)