forked from Innoz-Technologies/SMSGyan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chickipedia.php
156 lines (151 loc) · 7.1 KB
/
chickipedia.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
if (preg_match("~__readmorechick__(.+)__~Usi", $req, $match)) {
$url = $match[1];
$content = file_get_contents($url);
if (preg_match("~<div class = \"article\">(.+)</div>~Usi", $content, $match)) {
$article = $match[1];
$article = trim(preg_replace("~[\s]+~", " ", $article));
$article = strip_tags($article);
$article = html_entity_decode($article);
$article = trim(str_replace("’", "'", $article));
$article = trim(str_replace("“", "\"", $article));
$article = trim(str_replace("â€", "\"", $article));
echo $article;
$total_return = $article;
}
if ($total_return) {
$source_machine = $machine_id;
$current_file = "/temp/$numbers";
file_put_contents(DATA_PATH . $current_file, $total_return);
include 'allmanip.php';
$to_logserver['source'] = 'chicks';
putOutput($total_return);
exit();
}
} elseif (preg_match("~__chicks__(.+)__(.+)__~", $req, $match)) {
$url = $match[1];
$chckname = $match[2];
$content = file_get_contents($url);
// Image chick
if (preg_match("~<img id = \"avatar\" src = \"(.+)\" alt .+>~Usi", $content, $match)) {
echo $image_url = $match[1];
$image_url = file_get_contents("http://IP/services/goo.php?url=" . urlencode($image_url));
}
if (preg_match("~<h1 class = \"left\">(.+)</h1>~", $content, $match)) {
$name = $match[1];
}
// About the chick
if (preg_match("~ <!-- start the attributes -->(.+) <!-- end the attributes -->~Usi", $content, $match)) {
$about = $match[1];
$about = trim(preg_replace("~[\s]+~", " ", $about));
$about = trim(str_replace("</dt>", ":", $about));
$about = trim(str_replace("</dd>", "\n", $about));
$about = strip_tags($about);
$about = html_entity_decode($about);
$about = trim(str_replace("Add", "Nill", $about));
$about = trim(str_replace("\n ", "\n", $about));
$about = trim(str_replace("\n ", "\n", $about));
echo $about . "\n";
$total_return = $name . "\n" . $about . "\nImage: " . $image_url;
$q = "replace into chickpedia(name,about,image) values('" . mysql_real_escape_string($chckname) . "','" . mysql_real_escape_string($about) . "','" . mysql_real_escape_string($image_url) . "')";
$res = mysql_query($q);
if ($res) {
echo "inserted";
}
$options_list[] = "Read More";
$list[] = array("content" => "__readmorechick__" . $url . "__");
} elseif (preg_match("~<h1 class = \"left\">(.+)</h1>~", $content, $match)) {
$total_return = $match[1] . "\nNo more details available";
}
if ($total_return) {
$source_machine = $machine_id;
$current_file = "/temp/$numbers";
file_put_contents(DATA_PATH . $current_file, $total_return);
include 'allmanip.php';
$to_logserver['source'] = 'chicks';
putOutput($total_return);
exit();
}
} elseif (preg_match("~^chicks? (.+)~", $spell_checked, $match)) {
$name = $match[1];
$name = trim(str_replace(" ", "-", $name));
$url = trim("http://www.mademan.com/chickipedia/$name");
$contents = file_get_contents($url);
if (preg_match("~<img id = \"avatar\" src = \"(.+)\" alt .+>~Usi", $contents, $match)) {
echo $image_url = $match[1];
$image_url = file_get_contents("http://IP/services/goo.php?url=" . urlencode($image_url));
}
// About the chick
if (preg_match("~ <!-- start the attributes -->(.+) <!-- end the attributes -->~Usi", $contents, $match)) {
$about = $match[1];
$about = trim(preg_replace("~[\s]+~", " ", $about));
$about = trim(str_replace("</dt>", ":", $about));
$about = trim(str_replace("</dd>", "\n", $about));
$about = strip_tags($about);
$about = html_entity_decode($about);
$about = trim(str_replace("Add", "Nill", $about));
$about = trim(str_replace("\n ", "\n", $about));
$about = trim(str_replace("\n ", "\n", $about));
echo $about . "\n";
$total_return = $about . "\nImage: " . $image_url;
$q = "replace into chickpedia(name,about,image) values('" . mysql_real_escape_string($name) . "','" . mysql_real_escape_string($about) . "','" . mysql_real_escape_string($image_url) . "')";
$res = mysql_query($q);
if ($res) {
echo "inserted";
}
$options_list[] = "Read More";
$list[] = array("content" => "__readmorechick__" . $url . "__");
} else {
echo $url = trim("http://www.mademan.com/chickipedia/q/$name");
$contents = file_get_contents($url);
if (preg_match("~<p>Matches:</p>(.+)<!-- Previous page Link -->~Usi", $contents, $match)) {
if (preg_match_all("~<p><a href = \"/chickipedia/(.+)/\">(.+)</a></p>~", $match[1], $matches)) {
var_dump($matches);
echo "COUNT:" . count($matches[1]);
$total_return = "Chicks";
for ($i = 0; $i < count($matches[1]); $i++) {
$url = "http://www.mademan.com/chickipedia/" . trim($matches[1][$i]);
$options_list[] = $matches[2][$i];
$list[] = array("content" => "__chicks__" . $url . "__" . trim($matches[2][$i]) . "__");
}
}
} else {
$total_return = "No Chicks Found";
}
}
if ($total_return) {
$source_machine = $machine_id;
$current_file = "/temp/$numbers";
file_put_contents(DATA_PATH . $current_file, $total_return);
include 'allmanip.php';
$to_logserver['source'] = 'chicks';
putOutput($total_return);
exit();
}
} elseif (preg_match("~\b^(chick|chicks)\b~", $spell_checked)) {
$url = "http://www.mademan.com/chickipedia/";
$content = file_get_contents($url);
// chick of the day,week,and month
if (preg_match_all("~Chick of the .+</a>.+<p class = \"chick-name\"><a href = \"/chickipedia/(.+)/\">(.+)</a>~Usi", $content, $match)) {
echo $name_day = $match[2][0] . "\n";
echo $name_week = $match[2][1] . "\n";
echo $name_month = $match[2][2] . "\n";
echo $url_day = "http://www.mademan.com/chickipedia/" . trim($match[1][0]) . "\n";
echo $url_week = "http://www.mademan.com/chickipedia/" . trim($match[1][1]) . "\n";
echo $url_month = "http://www.mademan.com/chickipedia/" . trim($match[1][2]) . "\n";
$total_return = "Chicks Of The Day,Week,Month!!!";
$options_list[] = "Chick Of The Day:- $name_day";
$list[] = array("content" => "__chicks__" . trim($url_day) . "__" . trim($name_day) . "__");
$options_list[] = "Chick Of The Week:- $name_week";
$list[] = array("content" => "__chicks__" . trim($url_week) . "__" . trim($name_week) . "__");
$options_list[] = "Chick Of The Month:- $name_month";
$list[] = array("content" => "__chicks__" . trim($url_month) . "__" . trim($name_month) . "__");
}
if ($total_return) {
include 'allmanip.php';
$to_logserver['source'] = 'chicks';
putOutput($total_return);
exit();
}
}
?>