Alpha DevCon 2018
Results 1 to 2 of 2

Thread: Ham radio Logging code

  1. #1
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    374

    Default Ham radio Logging code

    Code:
    'Date Created: 29-May-2016 07:24:23 PM
    'Last Updated: 29-May-2016 07:34:19 PM
    'Created By  :KM4OUS
    'Updated By  :KM4OUS 
    
    dim shared qsod as C
    dim shared qtime as C
    dim shared qcall as c
    dim shared qband as c
    dim shared qfreq as c
    dim shared qmode as c
    dim shared qrsts as c
    dim shared qrstr as c
    dim shared stacall as c
    dim shared stagrid as c
    dim shared stadxcc as c
    
    qsod = date_format(DATE() , "yyyyMMdd")
    
    qtime=time("0hMMs", now(.T.))
    qcall="s4rg"
    qband="40m"
    qfreq="7.185"
    qmode="SSB"
    qrstr="59"
    qrsts="59"
    stacall="km4srg"
    stagrid="EL88PF"
    stadxcc="3"
    dim rqbody as c
    dim shared strADIF as c
    strADIF =" &<QSO_DATE:8>"+qsod+" <TIME_ON:6>"+qtime+" <CALL:4>"+qcall+" <BAND:3>"+qband+" <FREQ:9>"+qfreq+" <MODE:5>"+qmode+" <RST_SENT:3>"+qrsts+" <RST_RCVD:3>"+qrstr+" <STATION_CALLSIGN:6>"+stacall+" <GRIDSQUARE:6>"+stagrid+" <DXCC:3>"+stadxcc+"<EOR>"
    dim shared Callsign as c
    dim shared Code as C
    dim shared App as C
    dim shared Cmd as c
    dim shared ADIFkey as c
    dim cred as c
    dim etn as c
    etn="http://robot.hrdlog.net/newentry.aspx"
    cred="Callsign=TEST&Code=0000000000&App=KM4OUS Logger&ADIFData="+strADIF
    Cmd="GETQSO"
    ADIFkey="<CALL:4>"+qcall+"<QSO_DATE:8>"+qsod+" <TIME_ON:6>"+qtime+" <BAND:3>"+qband
    
    
    rqbody= cred
    
    
    
    dim Result as p
    Result=http_post(etn,rqbody)
    
    reply = Result.body
    ui_msg_box("Response",reply,UI_ATTENTION_SYMBOL)
    I'm trying to get a http_post() command to work correctly. I have played with it a few time and it was returning the correct xml data but it kept saying it was missing QSO_DATE and TIME_ON but i must have messed it up again because it stopped getting that. I have put the data so i can see what is being passed and it looks like the info on the c# examples are passing. It's called ADIF format for ham radio logging.
    Code:
    using System.Net; using System.IO;
    
     
    try
    {
     
    
    
    equest request =
     
    (HttpWebRequest)HttpWebRequest.Create("http://robot.hrdlog.net/newentry.aspx"); request.Timeout = 5000;
    request.ReadWriteTimeout = 20000; request.Method = "POST";
     
    request.ContentType = "application/x-www-for
     
    -urlencoded";
     
    
    string strADIF = "<QSO_DATE:8>20100606 <TIME_ON:6>135000 <CALL:5>LU2DC <BAND:3>15m
    <FREQ:9>21.070000 <MODE:5>PSK31 <RST_SENT:3>599 <RST_RCVD:3>599
    <STATION_CALLSIGN:6>IW1QLH <GRIDSQUARE:6>GF12ea <DXCC:3>100 <EOR>";
    // this string can?t contain the ampercent (&)
    
     
    string strForm =
    IF;
    "Callsign=TEST" +
    "&Code=0000000000"
    "&App=YourApplicationName" + "&ADIFData=" + strADIF
     
    
    // here the callsign
    // here the upload code
    // optional, here it?s possible to send the application name
     
    
    request.ContentLength = strForm.Length;
    StreamWriter sw = new StreamWriter(request.GetRequestStream(), Encoding.ASCII); sw.Write(strForm);
    sw.Close();
    
     
    HttpWebResponse response = (Htt
     
    WebResponse)request.GetResponse();
     
    StreamReader responseStream = new StreamReader(response.GetResponseStream());
     
    result = responseStream.ReadToE
    }
    catch (Exception ex) { }
    Here is another part I found
    You must use a HTTP request to http://robot.hrdlog.net/NewEntry.aspx ; only POST is allowed.

    Your request must contain this fields:

    • ADIFData: contact data formatted using ADIF rules; p.e. <QSO_DATE:8>20100606 <TIME_ON:6>135000
    <CALL:5>LU2DC <BAND:3>15m <FREQ:9>21.070000 <MODE:5>PSK31 <RST_SENT:3>599 <RST_RCVD:3>599
    <QSL_SENT:1>N <QSL_RCVD:1>N <STATION_CALLSIGN:6>IW1QLH <GRIDSQUARE:6>GF12ea <DXCC:3>100 <EOR>
    • Callsign: user callsign
    • Code:the upload code received via email after the registration to HRDLOG net
    • App (recommended): application name
    Last edited by steve745; 05-29-2016 at 09:01 PM.

  2. #2
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    374

    Default Re: Ham radio Logging code

    I think I just got it will post code in a few.

    It is returning now i edited the timeout a little and changed a few things that I may have forgot but none the less here is whats working.

    <code>'Date Created: 29-May-2016 07:24:23 PM
    'Last Updated: 29-May-2016 09:21:49 PM
    'Created By :
    'Updated By :

    dim shared qsod as C
    dim shared qtime as C
    dim shared qcall as c
    dim shared qband as c
    dim shared qfreq as c
    dim shared qmode as c
    dim shared qrsts as c
    dim shared qrstr as c
    dim shared stacall as c
    dim shared stagrid as c
    dim shared stadxcc as c

    qsod = date_format(DATE() , "yyyyMMdd")

    qtime=time("0hMMs", now(.T.))
    qcall="k4lol"
    qband="20m"
    qfreq="14.076"
    qmode="JT65"
    qrstr="-10"
    qrsts="-09"
    stacall="km4ous"
    stagrid="EL88PF"
    stadxcc="3"
    'dim rqbody as c
    'dim shared strADIF as c
    strADIF ="<QSO_DATE:8>"+qsod+" <TIME_ON:6>"+qtime+" <CALL:4>"+qcall+" <BAND:3>"+qband+" <FREQ:9>"+qfreq+" <MODE:5>"+qmode+" <RST_SENT:3>"+qrsts+" <RST_RCVD:3>"+qrstr+" <STATION_CALLSIGN:6>"+stacall+" <GRIDSQUARE:6>"+stagrid+" <DXCC:3>"+stadxcc+"<EOR>""
    dim shared Callsign as c
    dim shared Code as C
    dim shared App as C
    dim shared Cmd as c
    dim shared ADIFkey as c
    dim cred as c
    dim etn as c
    etn="http://robot.hrdlog.net/newentry.aspx"
    cred="Callsign=TEST&Code=0000000000&App="KM4OUS Logger"&ADIFData="+strADIF
    Cmd="GETQSO"
    ADIFkey="<CALL:4>"+qcall+"<QSO_DATE:8>"+qsod+" <TIME_ON:6>"+qtime+" <BAND:3>"+qband


    rqbody= cred



    dim Result as p
    Result=http_post("http://robot.hrdlog.net/newentry.aspx",rqbody,"",80,20000,.T.)

    reply = Result.body

    ui_msg_box("Response",reply,UI_ATTENTION_SYMBOL)


    'strADIF+crlf(5)+cred</code>
    Last edited by steve745; 05-29-2016 at 09:32 PM.

Similar Threads

  1. logging out
    By Portal 6 in forum Application Server Version 11 - Web/Browser Applications
    Replies: 1
    Last Post: 05-25-2012, 12:23 PM
  2. Logout not really logging out?
    By glenschild in forum Application Server Version 9 - Web/Browser Applications
    Replies: 4
    Last Post: 04-05-2010, 02:10 PM
  3. Logging Out
    By rleunis in forum Web Application Server v7
    Replies: 9
    Last Post: 03-16-2006, 12:41 PM
  4. logging on
    By Ian_Edwards in forum Web Application Server v6
    Replies: 2
    Last Post: 06-25-2005, 08:50 AM
  5. Logging Changes Made
    By Raheel Ahmed in forum Alpha Five Version 5
    Replies: 6
    Last Post: 03-11-2005, 01:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •