We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
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", …}
The text was updated successfully, but these errors were encountered:
How would you take this and filter out everything but "ip" and save that ip value as a variable to use later?
Sorry, something went wrong.
async function somefunc(){ let cloudflareJSON = await getCloudflareJSON() console.log(cloudflareJSON.ip) }
No branches or pull requests
Output:
The text was updated successfully, but these errors were encountered: