Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a command which I run on linux terminal like below:

curl –W "Authentication: Token r4r4xxxxx" "https://api.com/v1/results?display=true&format=image/jpeg&lang=en" –o image.jpg

And this command will authenticate me from the server and download the image named image.jpg to my local machine from where I am calling this command… But I am looking for a way to do this either in Ajax or Jquery or PHP would do… This is a web based application which will fetch a specific image from an API…. As I am trying to write a user friendly interface for users to be able to use this… I would like to know how can I replicate the same command above using any web based technology and how to pass parameters and both strings in quotes how would I pass them as I need them both.


What I have tried:

I have tried passing parameters in jQuery but response is Authentication method unknown.... Whats puzzling is according to the documentation this is how you pass everything... And it only works on terminal for me... I have set an object for parameters while using jQuery like so {authentication: xxxxxxxxxx}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900