Skip to content

Javascript Example to JSON #3

@fawazahmed0

Description

@fawazahmed0
async function getCloudflareJSON(){
let data = await fetch('https://1.0.0.1/cdn-cgi/trace').then(res=>res.text())
let arr = data.trim().split('\n').map(e=>e.split('='))
return Object.fromEntries(arr)
}

getCloudflareJSON().then(console.log)

Output:

{fl: "202f225", h: "1.0.0.1", ip: "47.37.137.777", ts: "1625581799.09", visit_scheme: "https", …}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions