So far, I have seen numerous examples on how to PUT a file in a Tika server using curl. For example from the Tika wikipage documentation we can conclude that if your file is in location
"file:///var/www/html/files/a.pdf"
in your machine and the Tika server runs on
http://localhost:9998
then using curl you can do a
curl -s "file:///var/www/html/files/a.pdf" | curl -X PUT -T - http://localhost:9998/meta
to get the metadata.
However, I haven't seen an example where the complete URI is given that makes the above JAXRS tika server providing the same result as the curl command above but showing the result in my browser this time and not on the terminal.
So, say I am visiting on my browser the tika server URI:
http://localhost:9998
what do I have to append to this URI in order to get the metadata like the curl command in my browser?
Thank you forum
The answer is in the curl command in your question:
curl -s "file:///var/www/html/files/a.pdf" | curl -X PUT -T - http://localhost:9998/meta
The URL you need to put to is at the end - http://localhost:9998/meta
You can also find all the endpoints in a Tika server from the listing linked from the welcome page when you go to the server with your web browser, and from Tika Wika Page for the Server
Related
If I run this code on my localhost through terminal or Insomnia. It is just working fine. But the server return null. What should I do to get the result?
curl -s 'https://i.instagram.com/api/v1/users/web_profile_info/?username=alanarblanchard' -H 'X-IG-App-ID: 936619743392459' | jq -r .data.user.id
Instagram doesn't allow requests from an unknown host. The workaround for this is to add the cookie in the request header
I need to download several zip files from this web page ....
http://www.geoportale.regione.lombardia.it/download-pacchetti?p_p_id=dwnpackageportlet_WAR_geoportaledownloadportlet&p_p_lifecycle=0&metadataid=%7B16C07895-B75B-466A-B980-940ECA207F64%7D
using curl or wget, so not in interactive way,
A sample url is the follow ...
http://www.geoportale.regione.lombardia.it/rlregis_download/service/package?dbId=323&cod=12
If I use this link in a new browser tab or window, all works fine but using curl or wget it's not possible to download the zipfile.
Trying to see what happen in the browser using Firebug, or in general the browser console, I can see that there is first a POST request and then a GET request (using Firebug ... ), so I'm not able to reproduce these requests using curl or wget.
Could be also that some cookies are sets in the browser session and the links do not work without that cookie?
Any suggestion will be appreciated ....
Cesare
NOTE: when I try to use a wget this is my result
NOTE 2: 404 Not found
NOTE 3 (the solution): the right command is
wget "http://www.geoportale.regione.lombardia.it/rlregis_download/service/package?dbId=323&cod=12"
then I've to rename the file in something like "pippo.zip" and this is my result, or, better using the -O option in this manner
wget "http://www.geoportale.regione.lombardia.it/rlregis_download/service/package?dbId=323&cod=12" -O pippo.zip
Looking at your command, you're missing the double quotes. Your command should be:
wget "http://www.geoportale.regione.lombardia.it/rlregis_download/service/package?dbId=323&cod=12"
That should download it properly.
So I want to make a daemon.php file which can open a port on a give ip address and request data from client.php and with the browser to listen/read to earlier pipe (Would that be a problem for the security or not?).
I fount this funphp tutorial which seems to be good but is more like a cronjob, I found also function stream-socket-server but can handle only one request and then shuts down, and I really don't know where exactly to put listener.
You can use the PHP Built-In Server
Add PHP to your PATH environment variable
Start your server on a given port, ex: php -S localhost:8000 OR
Start with a router script, ex: php -S localhost:8000 rt.php
Now, just open your browser and type; localhost:8000
I have a page (realized with a php framework) that add records in a MySQL db in this way:
www.mysite.ext/controller/addRecord.php?id=number
that add a row in a table with the number id passed via post and other informations such as timestamp, etc.
So, I movedo my eintire web applicazione to another domain and all HTTP requests works fine from old to new domain.
Only remaining issue is the curl: I wrote a bash script (under linux) that run curl of this link. Now, obviously it does not works because curl returns an alert message in which I read the page was moved.
Ok, I edited the curl sintax in this way
#! /bin/sh
link="www.myoldsite.ext/controlloer/addRecord.php?id=number"
curl --request -L GET $link
I add -L to follow url in new location but curl returns the error I wrote in this topic title.
It would be easier if I could directly modify the link adding the new domain but I do not have physical access to all devices.
GET is the default request type for curl. And that's not the way to set it.
curl -X GET ...
That is the way to set GET as the method keyword that curl uses.
It should be noted that curl selects which methods to use on its own depending on what action to ask for. -d will do POST, -I will do HEAD and so on. If you use the --request / -X option you can change the method keyword curl selects, but you will not modify curl's behavior. This means that if you for example use -d "data" to do a POST, you can modify the method to a PROPFIND with -X and curl will still think it sends a POST. You can change the normal GET to a POST method by simply adding -X POST in a command line like:
curl -X POST http://example.org/
... but curl will still think and act as if it sent a GET so it won't send any request body etc.
More here: http://curl.haxx.se/docs/httpscripting.html#More_on_changed_methods
Again, that's not necessary. Are you sure the link is correct?
I am developing an handwriting recog tool for android and I have planned to use a server for this purpose. I will be getting data from the android interface and send it to the server where it's stored in a file. I have a toolkit written in c which I will be using and I have to execute a few commands which will have text files as its parameters.
An example of a command:
HVite -A -D -T 1 -H C:\htk\model\hmm0\Single.mmf -i C:\htk\data\train\lab\1.mlf -w C:\htk\def\net.slf C:\htk\def\dict.txt C:\htk\model\hmm0\hmmlist.txt C:\htk\data\train\user\h1.txt
Where single.mmf, 1.mlf, net.slf, hmmlist.txt are the parameters to the command hvite. Is there a way to execute such commands on server and if yes what are the proposed solutions?
Secondly is sending data from android to the server and then doing all the processing on the server side a good choice? I would have to post the result back to android as well.
Try this command http://www.php.net/manual/en/function.pcntl-exec.php and notice that "Executes specified program in current process space" - this limits your program and on the other hand gives you safe environment. You may also want to look at this list http://php.net/manual/en/book.exec.php