Skip to content

Get the article URL when extracting data #16

@brandonStell

Description

@brandonStell

We could do it based on DOIs using something like this:

<?php
$doi = $argv[1];
$url = 'http://dx.doi.org/'.$doi;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$a = curl_exec($ch);
if(preg_match('#Location: (.*)#', $a, $r))
 $l = trim($r[1]);
return $l;

For things that don't have a DOI (only arXiv?) we can make the URL from the ID:

$arxivID = $argv[1];
$url 'https://arxiv.org/abs/'.$arxivID
return $url

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions