25 lines
536 B
Go
25 lines
536 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"io"
|
||
|
"log"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
func CheckClubogDXCC(callsign string) (string, error) {
|
||
|
// Clublog check DXCC
|
||
|
clublogURL := "https://clublog.org/dxcc?call=" + callsign + "&api=5767f19333363a9ef432ee9cd4141fe76b8adf38"
|
||
|
resp, err := http.Get(clublogURL)
|
||
|
if err != nil {
|
||
|
fmt.Println("error while getting DXCC from Clublog")
|
||
|
return "", err
|
||
|
}
|
||
|
defer resp.Body.Close()
|
||
|
body, err := io.ReadAll(resp.Body)
|
||
|
if err != nil {
|
||
|
log.Println("could not get dxcc from clublog", err)
|
||
|
}
|
||
|
return string(body), nil
|
||
|
}
|