-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcryptoapi_news.php
35 lines (24 loc) · 947 Bytes
/
cryptoapi_news.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
class cryptoapi{
private $url;
private $api;
public function __construct($api){
$this->url = "https://cryptoapi.news";
$this->api = $api;
}
public function lastNews($coin,$count){ // Supported coins : BTC, ETH, LTC, XRM | ALL = TO LIST ALL COINS | MAX COUNT : 10
$jsonurl = $this->url."/api/v1/".$this->api."/lastnews/".$coin."/".$count;
$json = file_get_contents($jsonurl);
print_r($json);
}
public function sentiment($coin){ // Supported coins : BTC, ETH, LTC, XRM | ALL = TO LIST ALL COINS / pow = Proof of work
$jsonurl = $this->url."/api/v1/".$this->api."/sentiment/".$coin;
$json = file_get_contents($jsonurl);
print_r($json);
}
}
$cryptoapi = new cryptoapi("free");
// Retrieves 10 most recent news
$cryptoapi->lastNews("all",10);
$cryptoapi->sentiment("pow");
$cryptoapi->sentiment("all");