W3C home > Mailing lists > Public > public-lod@w3.org > January 2010

Re: PHP RDF fetching code

From: Hugh Glaser <hg@ecs.soton.ac.uk>
Date: Thu, 28 Jan 2010 13:20:56 +0000
To: Yves Raimond <yves.raimond@gmail.com>
CC: "public-lod@w3.org" <public-lod@w3.org>
Message-ID: <EMEW3|2d810ee6a216982b01ffefd673f08774m0RDL502hg|ecs.soton.ac.uk|C7873FB8.FC5C%hg@ecs.soton.ac.uk>
Silly me - forgot all about it.
Thanks.


On 28/01/2010 13:07, "Yves Raimond" <yves.raimond@gmail.com> wrote:

> Hello Hugh!
> 
> Did you try EasyRDF?
> http://code.google.com/p/easyrdf/
> 
> It was coded by Nicholas Humfrey from the BBC and has quite a lot of
> cool features whilst being very lightweight - it also handles
> cURL-ing/parsing for you.
> 
> Cheers,
> y
> 
> On Mon, Jan 25, 2010 at 6:10 PM, Hugh Glaser <hg@ecs.soton.ac.uk> wrote:
>> OK, herešs some fun for you...
>> (Excuse me if it has been discussed before, and just point me at it :-) )
>> 
>> 
>> Having struggled through the php manual for cURL, I have come up with the
>> following draft for getting an RDF document, given a URI.
>> 
>>                        $ch = curl_init();
>>                        curl_setopt($ch, CURLOPT_URL, $_REQUEST['uri']);
>>                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
>>                        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
>>                        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept:
>> application/rdf+xml, text/n3, text/rdf+n3, text/turtle, application/x-turtle,
>> application/turtle, text/plain"));
>>                        $data = curl_exec($ch);
>>                        $info = curl_getinfo($ch);
>> 
>>                        if ($data === FALSE || $info['http_code'] != 200) {
>> 
>> What does anyone think?
>> Išm sure there are a bunch of improvements/corrections.
>> 
>> As a (hopefully) separate issue, the MIME types will probably generate some
>> discussion, but it is the PHP I am primarily asking about at the moment.
>> 
>> Best
>> Hugh
>> 
>> 
Received on Thursday, 28 January 2010 13:21:38 UTC

This archive was generated by hypermail 2.3.1 : Sunday, 31 March 2013 14:24:24 UTC