Skip to content

Instantly share code, notes, and snippets.

@hubgit
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hubgit/9666531 to your computer and use it in GitHub Desktop.
Save hubgit/9666531 to your computer and use it in GitHub Desktop.
Fetch data or code associated with a figshare DOI
<?php
// metadata: curl -L -H 'Accept: application/citeproc+json' 'http://dx.doi.org/10.6084/m9.figshare.963557'
$doc = new DOMDocument;
$doc->loadHTMLFile('http://dx.doi.org/10.6084/m9.figshare.963557');
$xpath = new DOMXPath($doc);
$url = $xpath->query('//div[@id="download_all"]/a')->item(0)->getAttribute('href');
exec(sprintf('wget %s', escapeshellarg($url)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment