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/03/27 16:42]
jeff
uphp:functions:fsockopen [2021/09/13 05:57] (current)
Line 1: Line 1:
 ======fsockopen====== ======fsockopen======
 +
 <badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge> <badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge>
  
Line 5: Line 6:
  
 ====Description==== ====Description====
-<well size="sm"><html><span style="font-size:125%;color:green;">int + 
-<span style="color:black;"></html>[[fsockopen]] +<well size="sm"><html> 
-<html>+<span style="font-size:125%;color:green">int 
-<span style="color:green;">string +<span style="color:black">fsockopen ( 
-<span style="color:blue;">$host<span style="color:black;">, +<span style="color:green">string 
-<span style="color:green;">int +<span style="color:blue">$host<span style="color:black">, 
-<span style="color:blue;">$port +<span style="color:green">int 
-<span style="color:black;">[, +<span style="color:blue">$port 
-<span style="color:green;">int +<span style="color:black">[, 
-<span style="color:blue;">$timeout +<span style="color:green">int 
-<span style="color:black;">] )+<span style="color:blue">$timeout 
 +<span style="color:black">] )
 </html></well> </html></well>
  
Line 21: Line 23:
  
 ====Parameters==== ====Parameters====
-<html><span style="color:blue;"><b>host</b><span style="color:black;"></html>:  Host name or IP address of server to connect to 
  
-<html><span style="color:blue;"><b>port</b><span style="color:black;"></html>:  Port number+<html><b><span style="color:blue">$host<span style="color:black"></b></html>:  Host name or IP address of server to connect to
  
-<html><span style="color:blue;"><b>timeout</b><span style="color:black;"></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">$port<span style="color:black"></b></html>:  Port number
  
-====Return Value==== +<html><b><span style="color:blue">$timeout<span style="color:black"></b></html>:  Connection timeout in secondsoptional (if not specified the system wide setting in [[software:os:config:uphp.ini]] will be used).
-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()]]+
  
-If the attempt to open the connection fails it will return 0+====Return Values====
  
 +<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
 +
 +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 54: 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
  
 [[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.1490632926.txt.gz · Last modified: 2021/09/13 05:56 (external edit)