16 lines
No EOL
501 B
C++
16 lines
No EOL
501 B
C++
import Crafter.CppDOM;
|
|
import std;
|
|
using namespace Crafter;
|
|
using namespace Crafter::CppDOMBindings;
|
|
|
|
HtmlElementPtr body("body", "<h1>Fetch Example</h1><p>Testing HTTP requests...</p>");
|
|
|
|
int main(){
|
|
Fetch("https://httpbin.org/get", [](std::string result){
|
|
if (!result.empty()) {
|
|
body.SetInnerHTML("<h1>Fetch Example</h1><p>Response: " + result + "</p>");
|
|
} else {
|
|
body.SetInnerHTML("<h1>Fetch Example</h1><p>Failed to fetch data</p>");
|
|
}
|
|
});
|
|
} |