|
|
@@ -48,19 +48,40 @@ function get_publication_details($document_reference) { |
|
|
|
$ch = curl_init(); |
|
|
|
curl_setopt($ch, CURLOPT_URL, $ops_url); |
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $access_token")); |
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $access_token", "Accept: application/json")); |
|
|
|
|
|
|
|
// Give back curl result |
|
|
|
$response = curl_exec($ch); |
|
|
|
curl_close($ch); |
|
|
|
|
|
|
|
if (strpos($response,"No results found") === false ) { |
|
|
|
$xml = new SimpleXMLElement($response); |
|
|
|
|
|
|
|
print_r($response); |
|
|
|
//var_dump($xml->{'exchange-documents'}->{'exchange-document'}->{'bibliographic-data'}->{'invention-title'}['lang']); |
|
|
|
//print_r($xml->xpath('//*')); |
|
|
|
//print_r($xml); |
|
|
|
// Turn the API response into useful Json |
|
|
|
$json = json_decode($response); |
|
|
|
|
|
|
|
// 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 ($invention_title->{'@lang'} === 'ol'){ |
|
|
|
|
|
|
|
$output['original_title'] = $invention_title->{'$'}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 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 ($abstract->{'@lang'} === 'ol'){ |
|
|
|
|
|
|
|
$output['original_abstract'] = $abstract->p->{'$'}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return $output; |
|
|
|
|
|
|
|
} |
|
|
|
|