Comments (9)
Tyler, do you know?
You are great man! 😃 Thank you again
@MeekLogic
from cloudflare-php.
I don't believe it's currently possible, however, I am working on adding just that as it's a needed in a project of mine.
from cloudflare-php.
Can the information on this page help us?
Is it not possible to get data with CURL?
from cloudflare-php.
@emresaracoglu yes, it is possible to get analytics data by API. The link you provided has a curl example
curl -X GET "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/analytics/dashboard?since=2015-01-01T12:23:00Z&until=2015-01-02T12:23:00Z&continuous=true" \
-H "X-Auth-Email: [email protected]" \
-H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
-H "Content-Type: application/json"
from cloudflare-php.
I can get the data but there is a big problem this time :)
I do not know how to read a complicated JSON file.
I plan to use a JSON reader for this. Maybe this; JsonReader - @pcrov
How do I read in the best way for JSON?
for example; bandwidth
in JSON
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://api.cloudflare.com/client/v4/zones/ZoneID/analytics/dashboard?since=2017-11-06T12:23:00Z&until=2017-11-07T12:23:00Z&continuous=true");
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = [
'X-Auth-Email: Email',
'X-Auth-Key: Key',
'Content-Type: application/json'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec ($ch);
curl_close ($ch);
from cloudflare-php.
I've added getAnalyticsDashboard()
to Zones
You can pull my fork until they add to a release - https://github.com/MeekLogic/cloudflare-php
from cloudflare-php.
@MeekLogic That's great work! Thank you for your time.
I have updated repository with your files
Could this connection be true?
$zones = new \Cloudflare\API\Endpoints\Zones($adapter);
$analytics = $zones->getAnalyticsDashboard("bbea500d1b4ca31fd42d9af01950fd6");
foreach ($analytics as $goster) {
echo $goster['bandwidth'];
//echo $goster['uncached'];
}
from cloudflare-php.
You probably don't want a foreach unless you are looping through the "timeseries"
If you want to get bandwidth total should be something like this
$zones = new \Cloudflare\API\Endpoints\Zones($adapter);
$analytics = $zones->getAnalyticsDashboard("bbea500d1b4ca31fd42d9af01950fd6");
echo $analytics->totals->bandwidth->all;
from cloudflare-php.
Released in 1.0.6
from cloudflare-php.
Related Issues (20)
- Create load balancer bug
- Add Lists support
- Update Accounts
- Add Images Support HOT 2
- Fatal error: Error code 6103, can't get domain zones HOT 1
- Feature to activate/deactivate Zone Lockdown Rule
- Delete an Account
- guzzle/guzzlehttp @6.5.2 in lockfile, ^7.0.1 required in composer.json HOT 2
- Import BIND file DNS records
- Import DNS Records
- Add Tunnel Endpoints HOT 2
- Custom hostnames - addHostname does not work HOT 2
- FirewallRuleOptions is missing the new managed_challenge option HOT 2
- Unblock IP Address
- What is the status of the PHP SDK? HOT 17
- Add DNSSEC Endpoint
- Update to be able to use Cloudflare as a secondary name server
- PageRules not work
- Worker Secrets API
- PSR/http-message HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudflare-php.