rj2700
rj2700

Reputation: 1965

GET and POST request through curl

Is it possible to send a GET and POST request using curl through a linux terminal?

Essentially, I'm trying to understand what these guys are doing in this tutorial but I don't understand how to add additional GET parameters to their tutorial's example.

For instance, in their tutorial (http://valeriobasile.github.io/candcapi/), they use the example of:

curl -d 'Every man loves a woman' 'http://gingerbeard.alwaysdata.net/candcapi/proxy.php/raw/pipeline?semantics=fol'

It works but I want a graphical representation of this. They also mention this in their example Here.

"An entry point to generate a PNG image...

$CANDCAPT/drg

"The URL accepts the same GET parameter as pipeline."

So I tried to send this but it doesn't get a PNG file:

curl -d 'Every man loves a woman&pipeline' 'http://gingerbeard.alwaysdata.net/candcapi/proxy.php/raw/pipeline?semantics=drs&roles=verbnet'

This actually breaks their system.

curl -d 'Every man loves a woman' 'http://gingerbeard.alwaysdata.net/candcapi/proxy.php/raw/pipeline?semantics=drs&roles=verbnet%20%@d%2dbox'

So my question is, I'm not too sure what the developers mean when they say the url accepts the same GET parameters and how would I add that in? Please let me know if you have any ideas, thanks.

EDIT 1 -

I tried adding drg instead of pipeline but it returns a message saying, "not found"

curl -d 'Every man loves a woman' 'http://gingerbeard.alwaysdata.net/candcapi/proxy.php/drg?semantics=fol'

Upvotes: 0

Views: 2044

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 520878

I read through the GitHub documentation, and at the bottom it describes how to obtain graphical output:

The C&C/Boxer API provides an entry point to generate a PNG image of the DRG of a given text:

$CANDCAPI/drg

The URL accepts the same GET parameter as pipeline and returns a raw PNG file.

Based on this, your GET url should look something like this:

http://gingerbeard.alwaysdata.net/candcapi/proxy.php/drg?semantics=fol

Using the "same" GET parameters means that whatever you passed to the pipeline after the question mark can also be passed to the drg web service.

Modified anwser:

Here's the correct command from the same example:

curl -d 'Every man loves a woman' 'http://gingerbeard.alwaysdata.net/candcapi/drg?semantics=fol'

And for people who are beginners like me, here's to save the png file:

curl -d 'Every man loves a woman' 'http://gingerbeard.alwaysdata.net/candcapi/drg?semantics=fol' >> image.png

Upvotes: 1

Related Questions