Browse Source

more error-handling and fixing some PHP errors

main
Simon Bowie 2 years ago
parent
commit
930b709141
2 changed files with 22 additions and 7 deletions
  1. +14
    -6
      site/ops_api.php
  2. +8
    -1
      site/public/random.php

+ 14
- 6
site/ops_api.php View File

$json = json_decode($response); $json = json_decode($response);


// For each invention title, check if it's in the original language // For each invention title, check if it's in the original language
foreach ($json->{'ops:world-patent-data'}->{'exchange-documents'}->{'exchange-document'}->{'bibliographic-data'}->{'invention-title'} as $invention_title){
if (isset($json->{'ops:world-patent-data'}->{'exchange-documents'}->{'exchange-document'}->{'bibliographic-data'}->{'invention-title'})){


if ((isset($invention_title->{'@lang'})) && ($invention_title->{'@lang'} === 'ol')){
foreach ($json->{'ops:world-patent-data'}->{'exchange-documents'}->{'exchange-document'}->{'bibliographic-data'}->{'invention-title'} as $invention_title){


$output['original_title'] = $invention_title->{'$'};
if ((isset($invention_title->{'@lang'})) && ($invention_title->{'@lang'} === 'ol')){

$output['original_title'] = $invention_title->{'$'};

}


} }


} }


// For each abstract, check if it's in the original language // For each abstract, check if it's in the original language
foreach ($json->{'ops:world-patent-data'}->{'exchange-documents'}->{'exchange-document'}->{'abstract'} as $abstract){
if (isset($json->{'ops:world-patent-data'}->{'exchange-documents'}->{'exchange-document'}->{'abstract'})){

foreach ($json->{'ops:world-patent-data'}->{'exchange-documents'}->{'exchange-document'}->{'abstract'} as $abstract){

if ((isset($abstract->{'@lang'})) && ($abstract->{'@lang'} === 'ol')){


if ((isset($abstract->{'@lang'})) && ($abstract->{'@lang'} === 'ol')){
$output['original_abstract'] = $abstract->p->{'$'};


$output['original_abstract'] = $abstract->p->{'$'};
}


} }



+ 8
- 1
site/public/random.php View File



<br><br> <br><br>


<?php
if (isset($random_record['title'])):
?>

Title: Title:


<?php <?php
<br><br> <br><br>


<?php <?php
endif;
?>


<?php
if (isset($publication_details['original_title'])): if (isset($publication_details['original_title'])):
?> ?>


?> ?>


<?php <?php
if ($random_record['abstract']):
if (isset($random_record['abstract'])):
?> ?>


Abstract: Abstract:

Loading…
Cancel
Save