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/04 13:27]
jeff
uphp:functions:fsockopen [2021/09/13 05:57] (current)
Line 7: Line 7:
 ====Description==== ====Description====
  
-<well size="sm"><html><span style="font-size:125%;color:green">int +<well size="sm"><html> 
-<span style="color:black"></html>[[fsockopen]] +<span style="font-size:125%;color:green">int 
-<html>(+<span style="color:black">fsockopen (
 <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 26: Line 26:
 <html><b><span style="color:blue">$host<span style="color:black"></b></html>:  Host name or IP address of server to connect to <html><b><span style="color:blue">$host<span style="color:black"></b></html>:  Host name or IP address of server to connect to
  
-<html><b><span style="color:blue">$port<span style="color:black"></b></html>:  Port <html><b><span style="color:green">number<span style="color:black"></b></html>+<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 59: Line 58:
 </code> </code>
  
-====See Also====+====Also See==== 
 + 
 +[[fopen()]] - Open a file for reading or writing
  
 [[fseropen()]] - Open the serial port at the specified baud rate with optional parameters [[fseropen()]] - Open the serial port at the specified baud rate with optional parameters
Line 65: Line 66:
 [[f485open()]] - Open the RS-485 port at the specified baud rate and parity [[f485open()]] - Open the RS-485 port at the specified baud rate and parity
  
-[[fopen()]] - Open a file for reading or writing+[[fread()]] - Read bytes from a file, stream or socket
  
-[[fclose()]] - Close a file, stream or socket+[[fgets()]] - Return a single line from a file, stream or socket, with optional size limit
  
-[[feof()]] - Test if no more data is available in a file or stream+[[fwrite()]] - Write data to a filestream or socket
  
-[[fgets()]] - Return a single line from a file or stream, with optional size limit+[[feof()]] - Test if no more data is available in a file, stream or socket
  
-[[fread()]] - Return bytes from a file or stream+[[filesize()]] - Return the size of a fileor the number of unread bytes in a stream or socket
  
-[[fwrite()]] - Write data to a file or stream+[[fseek()]] - Position the file pointer in an open file 
 + 
 +[[ftell()]] - Return the current position of a file read/write pointer 
 + 
 +[[fclose()]] - Close a file, stream or socket
  
uphp/functions/fsockopen.1491312429.txt.gz · Last modified: 2021/09/13 05:56 (external edit)