|
@@ -1,4 +1,6 @@
|
1
|
1
|
<?
|
|
2
|
+
|
|
3
|
+# Headers, cache, etc.
|
2
|
4
|
$debug = false;
|
3
|
5
|
|
4
|
6
|
if (empty($_GET['cn'])) {
|
|
@@ -16,6 +18,54 @@ if (!$debug && $Cache->get_value('jav_fill_json_'.$cn)) {
|
16
|
18
|
json_die('success', $Cache->get_value('jav_fill_json_'.$cn));
|
17
|
19
|
} else {
|
18
|
20
|
|
|
21
|
+ # Query the API
|
|
22
|
+ # @todo Valida to change $db
|
|
23
|
+
|
|
24
|
+/* @todo
|
|
25
|
+ * switch $category:
|
|
26
|
+ * case 'DNA' || 'RNA':
|
|
27
|
+ * if $number = refseq_regex:
|
|
28
|
+ * $db = 'refseq';
|
|
29
|
+ * break;
|
|
30
|
+ * case 'Protein':
|
|
31
|
+ * if $number = uniprot_regex:
|
|
32
|
+ * $db = 'uniprot';
|
|
33
|
+ * break;
|
|
34
|
+ * default:
|
|
35
|
+ * error 'invalid number';
|
|
36
|
+ * break;
|
|
37
|
+ */
|
|
38
|
+$id = 'NM_001183340.1';
|
|
39
|
+
|
|
40
|
+# Assemble the esearch URL
|
|
41
|
+$base = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/';
|
|
42
|
+$url = $base . "esummary.fcgi?db=$db&id=$id&version=2.0";
|
|
43
|
+
|
|
44
|
+# Post the esearch URL
|
|
45
|
+$output = file_get_contents($url);
|
|
46
|
+
|
|
47
|
+# Parse WebEnv and QueryKey
|
|
48
|
+#$web = $1 if ($output =~ /<WebEnv>(\S+)<\/WebEnv>/);
|
|
49
|
+#$key = $1 if ($output =~ /<QueryKey>(\d+)<\/QueryKey>/);
|
|
50
|
+
|
|
51
|
+### Include this code for ESearch-ESummary
|
|
52
|
+# Assemble the esummary URL
|
|
53
|
+$url = $base . "esummary.fcgi?db=$db&query_key=$key&WebEnv=$web";
|
|
54
|
+
|
|
55
|
+# Post the esummary URL
|
|
56
|
+$docsums = file_get_contents($url);
|
|
57
|
+print "$docsums";
|
|
58
|
+
|
|
59
|
+### Include this code for ESearch-EFetch
|
|
60
|
+# Assemble the efetch URL
|
|
61
|
+$url = $base . "efetch.fcgi?db=$db&query_key=$key&WebEnv=$web";
|
|
62
|
+$url .= "&rettype=abstract&retmode=text";
|
|
63
|
+
|
|
64
|
+# Post the efetch URL
|
|
65
|
+$data = file_get_contents($url);
|
|
66
|
+print "$data";
|
|
67
|
+
|
|
68
|
+ /*
|
19
|
69
|
$jlib_jp_url = ('http://www.javlibrary.com/ja/vl_searchbyid.php?keyword='.$cn);
|
20
|
70
|
$jlib_en_url = ('http://www.javlibrary.com/en/vl_searchbyid.php?keyword='.$cn);
|
21
|
71
|
$jdb_url = ('http://javdatabase.com/movies/'.$cn.'/');
|
|
@@ -141,7 +191,7 @@ if (!$debug && $Cache->get_value('jav_fill_json_'.$cn)) {
|
141
|
191
|
$image = 'https:'.$image;
|
142
|
192
|
}
|
143
|
193
|
if (!$desc) {
|
144
|
|
- //Shit neither of the sites have descriptions
|
|
194
|
+ // Shit neither of the sites have descriptions
|
145
|
195
|
$desc = '';
|
146
|
196
|
}
|
147
|
197
|
}
|
|
@@ -179,5 +229,5 @@ if (!$debug && $Cache->get_value('jav_fill_json_'.$cn)) {
|
179
|
229
|
$Cache->cache_value('jav_fill_json_'.$cn, $json, 86400);
|
180
|
230
|
|
181
|
231
|
json_die('success', $json);
|
182
|
|
-
|
|
232
|
+*/
|
183
|
233
|
}
|