Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I know this is an old question, but I could never get SimpleXML to do anything. Given that this is the only thing that comes up in a Google search about using the European Patent OFfice API with PHP, I thought I'd document what worked for me...</p> <p>Here's how I solved it:</p> <pre><code># build query url $patent_url = 'http://ops.epo.org/3.0/rest-services/published-data/search/full-cycle/?q='.urlencode($your_query); # grab the contents of $patent_url $patent_raw = file_get_contents($patent_url); # create an XML parser $resource = xml_parser_create(); # parse XML into array xml_parse_into_struct($resource, $patent_raw, $patent_array); # close the parser - you want to do this... xml_parser_free($resource); </code></pre> <p>Now you have a standard PHP array (<code>$patent_array</code>) you can iterate through. Note that this is similar to my code, but not exactly the same - you may have to tweak it if you cut/paste... Of course, you still have to figure out what to do with the ridiculously complex designed-by-committee data structure, but at least it's in mugable form.</p> <p>Edit:</p> <p>While trying to get more complex results, it became clear that EPO data is not strict XML. SimpleXML &amp; the above code both do nothing when trying to parse results. The solution was to use a DOM XML parser, which is fault tolerant. The code I used is described here: <a href="http://set.cooki.me/archives/225/php-dom-xml-to-array" rel="nofollow">http://set.cooki.me/archives/225/php-dom-xml-to-array</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload