Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Connect only.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 7.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
curl | The CURL session handle. | $curl |
Value | The option value. |
Returns OK or error.
See also CONNECT_ONLY option in CURL manual.
Download website and handle protocol ourself:
#Start new session
Set Variable [$curl; Value:MBS("CURL.New")]
#Set URL to load (HTTP, HTTPS, FTP, FTPS, SFTP, etc.)
Set Variable [$result; Value:MBS("CURL.SetOptionConnectOnly"; $curl; 1)]
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; CURL Low Level Sockets::URL)]
Set Variable [$request; Value:"GET / HTTP/1.1¶Host: www.monkeybreadsoftware.de¶¶" // must end with two empty lines ]
Set Variable [$request2; Value:MBS( "Text.ReplaceNewline"; $request; 3)]
#RUN now
Set Field [CURL Low Level Sockets::Connect Result; MBS("CURL.Perform"; $curl)]
#Check result
Set Field [CURL Low Level Sockets::Data Received; MBS("CURL.GetResultAsText"; $curl; "UTF8")]
Set Field [CURL Low Level Sockets::Debug Messages; MBS("CURL.GetDebugAsText"; $curl)]
If [CURL Low Level Sockets::Connect Result = "OK"]
Set Variable [$r; Value:MBS( "CURL.SendText"; $curl; $request2; "UTF-8")]
Set Field [CURL Low Level Sockets::Data Sent; $request]
Set Variable [$received; Value:""]
Loop
Pause/Resume Script [Duration (seconds): ,1]
Set Variable [$r; Value:MBS( "CURL.ReceiveText"; $curl; 100000; "UTF-8")]
Set Variable [$errorCode; Value:MBS( "CURL.ErrorCode"; $curl)]
If [GetAsNumber ( $errorCode ) = 81]
#wait
Else If [GetAsNumber ( $errorCode ) = 0]
#got some data
Set Variable [$received; Value:$received & $r]
Exit Loop If [$r = ""]
Else
#error
Exit Loop If [1]
End If
End Loop
Set Variable [$received2; Value:MBS( "Text.ReplaceNewline"; $received; 1)]
Set Field [CURL Low Level Sockets::Debug Messages; MBS("CURL.GetDebugAsText"; $curl)]
Set Field [CURL Low Level Sockets::Data Received; $received2]
End If
#Cleanup
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]
Check if SMB (port 445) is open on a given IP in network:
Let ( [
curl = MBS("CURL.New");
a = MBS( "CURL.SetOptionConnectOnly"; curl; 1 );
b = MBS( "CURL.SetOptionURL"; curl; "192.168.2.117" );
c = MBS( "CURL.SetOptionConnectionTimeout"; curl; 1 );
d = MBS( "CURL.SetOptionPort"; curl; 445 );
r = MBS( "CURL.Perform"; curl );
x = MBS( "CURL.Release"; curl)
]; r )
// returns either
// OK
// or
// 28: Connection timed out after 1000 milliseconds
Created 27th March 2017, last changed 19th April 2020
CURL.SetOptionCertInfo - CURL.SetOptionConnectTimeoutMS
Feedback: Report problem or ask question.