diff --git a/getdata.php b/getdata.php index 738ea37..c2a9498 100644 --- a/getdata.php +++ b/getdata.php @@ -4,52 +4,43 @@ $password="vpsad24068"; $hostname = "localhost"; //connection string with database $dbhandle = mysqli_connect($hostname, $username, $password) -or die("Unable to connect to MySQL"); -echo ""; + or die("Unable to connect to MySQL"); + // connect with database $selected = mysqli_select_db($dbhandle, "wptest") -or die("Could not select examples"); -//$email = 'francesco.finazzi@unibg.it'; + or die("Could not select examples"); + $queryurl = "SELECT url,email FROM wp_autori2url"; $result = mysqli_query($dbhandle,$queryurl); -//$url = 'http://export.arxiv.org/api/query?search_query=au:Finazzi_F'; + $url = ''; while($row = mysqli_fetch_object($result)){ $url = $row->url; $email = $row->email; -$xml = file_get_contents($url); -$newxml = str_replace('arxiv:','arxiv_',$xml); -//$xml = simplexml_load_file($url); //retrieve URL and parse XML content -//echo $xml->getName(); // output name of root element -$xmlparse = simplexml_load_string($newxml); -//$xmlparse = simplexml_load_string(html_entity_decode($xml), 'SimpleXMLElement', LIBXML_NOCDATA); + $xml = file_get_contents($url); + $newxml = str_replace('arxiv:','arxiv_',$xml); + //$xml = simplexml_load_file($url); //retrieve URL and parse XML content + //echo $xml->getName(); // output name of root element + $xmlparse = simplexml_load_string($newxml); + //$xmlparse = simplexml_load_string(html_entity_decode($xml), 'SimpleXMLElement', LIBXML_NOCDATA); -// $xml = file_get_contents('http://export.arxiv.org/api/query?search_query=au:Finazzi_F'); -//$articoli = array('http://export.arxiv.org/api/query?search_query=au:Finazzi_F'); -//foreach( $articoli as $articolo ) { -//$xml = simplexml_load_file($articoli); + $queryTrun = " TRUNCATE TABLE wp_rawdata "; + mysqli_query($dbhandle,$queryTrun); -$queryTrun = " TRUNCATE TABLE wp_rawdata "; -mysqli_query($dbhandle,$queryTrun); + foreach($xmlparse->entry as $item) + { + $date_format = "j-n-Y"; // 7-7-2008 -foreach($xmlparse->entry as $item) -{ -$date_format = "j-n-Y"; // 7-7-2008 - -// foreach($item->xpath('link') as $link) -// { -// echo $link->xpath('title'); -// } - - echo '
';
- echo $item->published;
- echo '
'.$item->title.'
';
- echo '
';
+ echo $item->published;
+ echo '
'.$item->title.'
';
+ echo '