Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl command execute within plsh #9

Open
walpino opened this issue Jul 13, 2016 · 3 comments
Open

curl command execute within plsh #9

walpino opened this issue Jul 13, 2016 · 3 comments

Comments

@walpino
Copy link

walpino commented Jul 13, 2016

i want to execute curl from plsh

the procedure looks like

!/....

curl "$1"

and $1 looks like

'https://.....ewad.json' -v -X POST --data-urlencode 'address=fdfdf 38' --insecure --data-urlencode 'size=65' --data-urlencode 'hash=47b51e9dd1c6a833a7f3effe2ee9dc997632' --data-urlencode 'action=insert_ad' --data-urlencode 'region=14' --data-urlencode 'zipcode=3012' --data-urlencode 'app_id=homegate' --data-urlencode 'phone=07382' --data-urlencode 'email=[email protected]' --data-urlencode 'body=Beautiful unfu' --data-urlencode 'phone_hidden=0' --data-urlencode 'price=1455' --data-urlencode 'category=1020' --data-urlencode 'rooms=4' --data-urlencode 'area=92' --data-urlencode 'company_ad=1' --data-urlencode 'lang=de' --data-urlencode 'name= ' --data-urlencode 'subject=2.5 room Apartment for rent' --data-urlencode 'no_licenseplate=1' --data-urlencode 'type=u' --data-urlencode 'store_id=49' --data-urlencode 'import=1' --data-urlencode 'external_ad_id=103466419'

the return value is curl(3) illegal character hmm but

if I execute this on the prompt everything works fine

do you have a hint whats wrong with this?

thanks

@petere
Copy link
Owner

petere commented Jul 15, 2016

Please show the exact function definition (CREATE FUNCTION ...).

@walpino
Copy link
Author

walpino commented Jul 15, 2016

just a simple example

CREATE OR REPLACE FUNCTION query (x int) RETURNS text
LANGUAGE plsh
AS $$
#!/bin/sh
/usr/bin/curl www.zkb.ch > /tmp/a.html
/usr/bin/wget www.zkb.ch > /tmp/a.html
$$;

the curl throws an error
the wget works

if I'm doing this on the prompt the curl works fine too

@petere
Copy link
Owner

petere commented Aug 9, 2016

And what is your output?

You probably have to run curl with -s and wget with -q or similar, because plsh will interpret any output to stderr as failure. Other than that, your example works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants