-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgimme_str_album_count.php
65 lines (38 loc) · 1.12 KB
/
gimme_str_album_count.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
error_reporting(0);
require_once('./config.php');
if (file_exists('./d/artists.txt')){
$str_cnt_artists_file=file_get_contents('./d/artists.txt');
}
else {
$str_cnt_artists_file=false;
}
if ($str_cnt_artists_file!==false){
$str_cnt_artists=explode("\n", trim($str_cnt_artists_file));
$str_cnt_querystring='';
foreach ($str_cnt_artists as $str_cnt_artist)
{
$str_cnt_querystring.='l2[]='.urlencode($str_cnt_artist).'&';
}
$str_cnt_ch = curl_init();
curl_setopt($str_cnt_ch, CURLOPT_URL, $serverapi.'?l2=true');
curl_setopt($str_cnt_ch, CURLOPT_POST, 1);
curl_setopt($str_cnt_ch, CURLOPT_POSTFIELDS, $str_cnt_querystring);
curl_setopt($str_cnt_ch, CURLOPT_CONNECTTIMEOUT ,15000);
curl_setopt($str_cnt_ch, CURLOPT_TIMEOUT, 15000);
curl_setopt($str_cnt_ch, CURLOPT_RETURNTRANSFER, true);
$str_cnt_albums_file_json= curl_exec ($str_cnt_ch);
curl_close ($str_cnt_ch);
$str_cnt_albums_file=$str_cnt_albums_file_json;
$str_cnt_albums=json_decode($str_cnt_albums_file_json, true);
if ($str_cnt_albums===null){
echo '0';
}
else {
echo count($str_cnt_albums);
}
}
else{
echo '-1';
}
?>