$filename = 'afd.ris'; $filename = '296e26ee-ce62-4efa-8f80-a7a037570a45.ris'; //$filename = '757e3d6a-bbcc-4573-8de3-210c611dc93d.ris'; $filename = '8f5f6ff0-6dcc-49f6-bb7c-60a8325ee210.ris'; $filename = '03811041-933f-4bd1-9b52-44a09d5fcf2e.ris'; $filename = 'c202c04e-3c81-4a8e-a648-1ea83db1cd21.ris'; $filename = 'b72ae515-9c9e-49df-b3f1-936c7c2e3833.ris'; $filename = '21bc7535-4317-4ce0-a287-e13e47efabbe.ris'; $filename = 'b8d89012-9059-4af0-a0a1-093cb69103e8.ris'; $filename = 'c7ae0257-fb30-4e4d-adfd-e68724df0b69.ris'; $filename = 'bd6ed9f5-0edd-4be8-8e39-a8754d8a1985.ris'; $filename = 'db86c064-6846-42c9-81a9-e7d9a1d3fbd0.ris'; $filename = '8da39a69-b913-40ce-a32b-c0bda72cabfc.ris'; // Geo $filename = '7eb47f5d-f491-45b8-84ef-00a1f7cbf3c8.ris'; $filename = 'e08b6613-7add-4f2e-b934-9869b1d68884.ris'; $filename = 'bc2438b9-9840-45fb-a549-27a934cf1462.ris'; $filename = 'd47ad5f4-08d8-4893-96b0-a4c492077dbe.ris'; $filename = 'c696c01d-88d3-449c-b392-ea592474bec7.ris'; $filename = 'b23c9277-e4d9-48ef-84d1-a124812d7dcb.ris'; $filename = '2fb8db9d-e944-4a5d-8938-3c8e98008d20.ris'; // addme-2010-12-06 $filename = 'addme-2010-12-06.ris'; // 2011-01-10 (first result from checkparse) $filename = '2011-01-10.ris'; // Import a RIS file and add to CouchDB database $file = @fopen($filename, "r") or die("couldn't open {$filename}"); $ris = @fread($file, filesize($filename)); fclose($file); import_ris($ris, 'couchdb_import');
$html[$reference->year] .= '<div>'; $html[$reference->year] .= '<a href="' . $reference->url . '" target="_new"><img src="http://biostor.org/bhl_image.php?PageID=' . $PageID . '&thumbnail" /></a><br/>'; $html[$reference->year] .= '<a href="http://www.biodiversitylibrary.org/page/' . $PageID . '" target="_new">' . $PageID . '</a><br/>'; $html[$reference->year] .= $reference->title . '<br/>'; $html[$reference->year] .= '</div>'; } } else { $year_roman[$reference->year]++; } } $filename = 'all.ris'; //$filename = 'test.ris'; $file = @fopen($filename, "r") or die("couldn't open {$filename}"); $ris = @fread($file, filesize($filename)); fclose($file); import_ris($ris, 'import'); /* echo "Articles in each year\n"; print_r($year_actual); echo "Articles in each year found in BioStor\n"; print_r($year_found); echo "Articles in each year with roman numbers\n"; print_r($year_roman); */ foreach ($html as $year => $h) { $h .= '</body></html>'; $filename = $year . '.html'; $file = @fopen($filename, "w") or die("couldn't open {$filename}"); fwrite($file, $h); fclose($file); }
// Clean $html = preg_replace('/<font size=-2 class="w"><b>\\[PDF\\]<\\/b><\\/font> <span class=a>►<\\/span>/', '', $html); $html = preg_replace('/<span class=a>►<\\/span>/', '', $html); $html = str_replace("\n", " ", $html); //echo $html; //exit(); $title_url = ''; // get URLs if (preg_match('/<h3 class="r"><a href="(?<url>([^"]|(?R))*)/', $html, $matches)) { $title_url = $matches['url']; } // get RIS if (preg_match('/<a href="\\/scholar.ris\\?(?<q>.*)">Import into RefMan<\\/a>/Uu', $html, $matches)) { //print_r($matches); $url = 'http://scholar.google.com/scholar.ris?' . str_replace('&', '&', $matches['q']); //echo $url; curl_setopt($ch, CURLOPT_URL, $url); $ris = curl_exec($ch); if (curl_errno($ch) != 0) { } $ris = str_replace("\r\nER", "\r\nUR - {$title_url}\r\nER", $ris); $ris = utf8_encode($ris); header("Content-type: text/plain; charset=utf-8\n\n"); echo $ris; if (preg_match('/TY \\- JOUR/', $ris)) { if ($store) { import_ris($ris); echo "\r\nStored\r\n"; } } }