I try to reach the mod harbour websercice.
http://www.modharbour.org/modharbour_sa ... ervice.prg
But my program errors out.
Can you please help me?
Best regards,
Otto
[ 2] = U nil
called from: CHARACTER:__OPPLUS, line: 0
called from: ..\source\exec.prg, INLINEPRG, line: 103
called from: pcode.hrb, MAIN, line: 53
called from: HB_HRBDO, line: 0
called from: ..\source\exec.prg, EXECUTE, line: 70
- Code: Select all Expand view
#define HB_CURLOPT_POST 47
#define HB_CURLOPT_URL 2
#define HB_CURLOPT_DL_BUFF_SETUP 1008
#define HB_CURLOPT_POSTFIELDS 15
function main()
TEMPLATE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Basic test CURL mod_harbour</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.css"/>
</head>
<body>
<div class="container">
<div class="row">
<h1>Basic test CURL mod_harbour</h1>
<div class="col-sm-12">
<?prg
local uValue
curl_global_init()
if ! empty( hCurl := curl_easy_init() )
curl_easy_setopt( hCurl, HB_CURLOPT_POST, 1 )
curl_easy_setopt( hCurl, HB_CURLOPT_URL, "http://www.modharbour.org/modharbour_samples/webservice.prg" )
curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP )
curl_easy_setopt( hCurl, HB_CURLOPT_POSTFIELDS, hb_jsonEncode( { "key1" => "value1", "key2" => "value2", "key3" => "value3" } ) )
if curl_easy_perform( hCurl ) == 0
uValue = curl_easy_dl_buff_get( hCurl )
endif
endif
curl_global_cleanup()
?>
<div>
</div>
</div>
</body>
</html>
ENDTEXT
return NIL
//----------------------------------------------------------------------------------------//