Browse Source

fixing some errors

main
Simon Bowie 2 years ago
parent
commit
38823c439d
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      site/ops_api.php

+ 4
- 2
site/ops_api.php View File



if (strpos($response,"No results found") === false ) { if (strpos($response,"No results found") === false ) {


global $output;

// Turn the API response into useful Json // Turn the API response into useful Json
$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){ foreach ($json->{'ops:world-patent-data'}->{'exchange-documents'}->{'exchange-document'}->{'bibliographic-data'}->{'invention-title'} as $invention_title){


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


$output['original_title'] = $invention_title->{'$'}; $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){ foreach ($json->{'ops:world-patent-data'}->{'exchange-documents'}->{'exchange-document'}->{'abstract'} as $abstract){


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


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



Loading…
Cancel
Save