The API interface in PC Software can use the HTTP Post Extension
The http address is http(s)://www.bridgewebs.com/cgi-bin/bwx/api.cgi?club=xxx
where xxx is your club code (repeat of parameters)
The following are suggestions based on feedback and will need to be verified in your particular software
Please Note, your SSL/TLS Interface software will need to use the latest TLSv1.2 to use https
As an example, see https://stackoverflow.com/questions/36574711/could-not-create-ssl-tls-secure-channel-getrequeststream
VB API Code
A suitable VB example for doing this can be found at http://www.example-code.com/vb/http_post_form.asp, or just search Google, so that the code would look something like:
Dim h As HTTPClass
Set h = New HTTPClass
Set clubcode = "myclub"
h.Fields("club") = clubcode
h.Fields("password") = "secret"
..........
If h.OpenHTTP("www.bridgewebs.com") Then
Debug.Print h.SendRequest("cgi-bin/bwx/api.cgi?club=" & clubcode, "POST")
End If
VB Net Code
A suitable VB class for doing this can be found at https://www.example-code.com/vbscript/http_formSubmitPost.asp, or just search Google, so that the code would look something like:
Public Function GetFromWebSite() As Boolean
' Get the player database from BridgeWebs
Cursor.Current = Cursors.WaitCursor
Dim h As HttpClass
h = New HttpClass
Dim x As Integer = 0
Dim strPost As String = ""
h.Fields("club") = "my_club"
h.Fields("type") = "download"
h.Fields("password") = "password"
h.Fields("filename") = "players.txt"
If h.OpenHTTP("www.bridgewebs.com") Then
strPost = h.SendRequest("cgi-bin/bwx/api.cgi?club=" & "my_club", "POST")
Else
' Provide the error returned from the open call
MsgBox("Error on HTTP Open " & strPost, vbInformation, "Get from Web")
Cursor.Current = Cursors.Arrow
Return False
End If
x = InStr(strPost, "Download Successful")
If x = 0 Then
' Provide the error returned from the open call
MsgBox("HTTP Post operation failed while retrieving Player Database " & vbCrLf & strPost, vbCritical, "Post error")
Cursor.Current = Cursors.Arrow
Return False
End If
' The string returned is in the format Data = "......." Message = "Download....."
' strip of the text we dont want
' Store the text in our global field
a1.PlayerDownload = Mid(strPost, 8, x - 17)
Cursor.Current = Cursors.Arrow
Return True
End Function
PHP API Code
Code for PHP will look something like, but not been tested.
$reply = "";
$clubcode = "myclub";
$data = "club=".urlencode(clubcode);
$data .= "&password=".urlencode("secret");
............
$header = "POST /mailer/send HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($data) . "\r\n\r\n";
$fp = fsockopen('http://www.bridgewebs.com/cgi-bin/bwx/api.cgi?club=' . $clubcode, 443, $errno, $errstr, 30);
if(!$fp)
return "ERROR. Could not open connection";
else {
fputs ($fp, $header.$data);
while (!feof($fp)) {
$reply .= fread ($fp, 1024);
}
fclose($fp);
}
print $reply;
Linux Perl API Code
Code for Perl will look something like, but not been tested.
my $clubcode = 'myclub";
my $url = 'http://www.bridgewebs.com/cgi-bin/bwx/api.cgi?club=' . $clubcode;
my $object = LWP::UserAgent->new;
my $request = $object->post ( $url,
{ 'club' =>$clubcode,
'password' => 'secret',
'type' => 'download',
.........
} );
my $reply = $request->as_string ();
print $reply;
'C' API Code (C# .NET 4.5)
Code for 'C' will look something like, but not been tested.
async private void cmdUpload_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(m_UsebioFile)) // Check if xml file has already been created
{
cmdUsebio_Click(this, new EventArgs()); // If not, create it
if (String.IsNullOrEmpty(m_UsebioFile))
{
MessageBox.Show("Failed to create file for upload!", Dashboard.WarningMsgTitle);
return;
}
}
// Create Key/Value pairs for the data
Dictionary KVPs = new Dictionary(5);
KVPs.Add("club", ClubID);
KVPs.Add("password", "password");
KVPs.Add("type", "upload");
KVPs.Add("filename", m_UsebioFile);
KVPs.Add("data", File.ReadAllText(Path.Combine(Properties.Settings.Default.UsebioPath, m_UsebioFile)));
FormUrlEncodedContent fuec = new FormUrlEncodedContent(KVPs);
HttpClient client = new HttpClient();
HttpResponseMessage response = await client.PostAsync("http://www.bridgewebs.com/cgi-bin/bwx/api.cgi?club=" + ClubID, fuec);
if (!response.IsSuccessStatusCode)
MessageBox.Show("Upload failed!\r Status Code: " + response.StatusCode.ToString() + "\r Reason: " + response.ReasonPhrase, Dashboard.WarningMsgTitle,
MessageBoxButtons.OK,MessageBoxIcon.Warning);
}