Closed x-fran closed 8 years ago
Hi Francisc,
The results are wrong, actually all the params are considered as content since you send the data as application/x-www-form-urlencoded
.
I am not familiar with the performing HTTP requests with the Zend framework but here are some tips that might solve you problem:
Content-Type
header to text/plain
set the parameters as part of the main URI.
$request->setUri("http://api-dev.freme-project.eu/current/e-entity/dbpedia-spotlight/documents?confidence=0.3&informat=text&outformat=json-ld");
setContent
function which can be used to set the body. See http://framework.zend.com/manual/current/en/modules/zend.http.request.html#zend-stdlib-message-methods-set-contentIf you are familiar with cURL, here is one line command which do the same thing
request against DBpedia Spotlight
curl -v -X POST -d "Welcome to Berlin." "http://api-dev.freme-project.eu/current/e-entity/dbpedia-spotlight/documents?confidence=0.3&informat=text&outformat=json-ld" -H "Content-Type: text/plain"
request against FREME NER (recommended)
curl -v -X POST -d "Welcome to Berlin." "http://api-dev.freme-project.eu/current/e-entity/freme-ner/documents?informat=text&outformat=json-ld&dataset=dbpedia&language=en" -H "Content-Type: text/plain"
BTW, its not good practice to write your own parser for RDF (serialized as turtle, json-ld, rdf/xml, etc.). I recommend you use well-established RDF parsers for PHP. Here are some RDF libraries you can use in PHP: http://www.easyrdf.org/ http://wifo5-03.informatik.uni-mannheim.de/bizer/rdfapi/ http://graphite.ecs.soton.ac.uk/
Hope it helps!
Sorry, I was a little bit busy. I will take a look and see what is happening. I'm sure all this info it will help. Thank you.
I performed the changes. Is working as expected.
Great! let us know if you need any help, ... any feedback is also more than welcome!
I'm playing with this piece of code in zend framework 2.
And I have this back:
I'm doing something wrong?