curl

How to send image to Flask server from curl request

折月煮酒 提交于 2020-07-05 08:30:18
问题 I want to send an image by curl to flask server, i am trying this curl command curl -X POST -F file=image.jpg "http://127.0.0.1:5000/" but it did not work by the way on the server side i handle the image by this code image = Image.open(request.files['file']) i am trying to read the image using PIL Is there anyway to do this? Thanks in advance 回答1: This worked for me: curl -F "file=@image.jpg" http://localhost:5000/ The '@' is important, otherwise you end up with an http error 400 (server

How to send image to Flask server from curl request

喜夏-厌秋 提交于 2020-07-05 08:29:10
问题 I want to send an image by curl to flask server, i am trying this curl command curl -X POST -F file=image.jpg "http://127.0.0.1:5000/" but it did not work by the way on the server side i handle the image by this code image = Image.open(request.files['file']) i am trying to read the image using PIL Is there anyway to do this? Thanks in advance 回答1: This worked for me: curl -F "file=@image.jpg" http://localhost:5000/ The '@' is important, otherwise you end up with an http error 400 (server

cURL request in Laravel

这一生的挚爱 提交于 2020-07-04 06:34:05
问题 I am struggling to make this cURL request in Laravel curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X GET http://my.domain.com/test.php I've been trying this: $endpoint = "http://my.domain.com/test.php"; $client = new \GuzzleHttp\Client(); $response = $client->post($endpoint, [ GuzzleHttp\RequestOptions::JSON => ['key1' => $id, 'key2' => 'Test'], ]); $statusCode = $response->getStatusCode(); But I am getting an error Class 'App\Http\Controllers\GuzzleHttp

How to perform grep on curl within for loop?

跟風遠走 提交于 2020-07-03 17:40:11
问题 I have created an array uisng the command IFS=', ' read -r -a array <<< "$(command)" The array has values: abc001 abc002 abc003 I want to loop through the array and run a curl command on each element. a) If curl output has string Connected then the curl command should timeout and the for loop should exit out. b) If the curl output is not having string Connected then the curl command should timeout and for loop should move to next element. I have written the following code. for element in "$

What else can I do to make sure that curl is working when I am using R ( MetaboAnalyst package) in Windows 10?

余生长醉 提交于 2020-07-03 13:14:16
问题 I have windows 10, so I already have curl, which is located in this path on my laptop C:\Windows\System32. I have used the advice on this post How do I install and use curl on Windows?, and added this location to Path under Systems Variables. When I type the below into R, I can see, amongst others, this path location. Sys.getenv("PATH") I would like to use the MetaboAnalyst pathway package in R (https://www.rdocumentation.org/packages/MetaboAnalystR/versions/2.0.0). However, I am met with the

PHP/Laravel: cURL error 56: SSL read: error:00000000:lib

蓝咒 提交于 2020-06-29 09:52:31
问题 I am getting this error on one function in my laravel application. yesterday everything worked fine. cURL error 56: SSL read: error:00000000:lib(0):func(0):reason(0), errno 104 (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in CurlFactory.php line 187 at CurlFactory::createRejection(object(EasyHandle), array('errno' => '56', 'error' => 'SSL read: error:00000000:lib(0):func(0):reason(0), errno 104', 'url' => 'https://server7.phasehosting.io:2087/json-api/dumpzone?&domain=phasedev.be',

POST multiple files with -d in curl

情到浓时终转凉″ 提交于 2020-06-29 04:58:08
问题 I'm using curl to create several classifications. I have written the json for the many classifications and they are in one folder. I would like to create all the classifications in one go. But using curl I can only create them one at a time. How could I make them in one request? curl -u admin:admin -H "Content-Type: application/json" -X POST -d @pii.json http://127.0.0.1:21000/api/atlas/v2/types/typedefs The curl manual for -d says 'Multiple files can also be specified'. How can I do this?

Why does SSL connection fails when using intermediate CA?

女生的网名这么多〃 提交于 2020-06-29 04:25:07
问题 Given stackoverflow.com cert chain as follows: Builtin DST Root CA -> Let's encrypt intermediate CA -> *.stackexchange.com Is it possible to make a TLS connection using intermediate CA as trusted CA? curl https://stackoverflow.com -v --cacert stack_intermediate_ca.pem --capath /dev/null -o /dev/null curl: (60) SSL certificate problem: unable to get issuer certificate Is it because the intermediate CA is presented in the server chain during TLS handshake? Or do all certs in chain have to be

how can i make valid signature php openssl

丶灬走出姿态 提交于 2020-06-28 07:42:15
问题 how can i generate valid signature and how to sign request body with my private key me already try code like this but the result always signature not valid is there any other way? before asking me already searching google for solved the problem but me not yet have a corret answer function mgAccount(){ $url = "http://aaaa.com"; $getFields = [ "oaa_id" => 838, ]; $data_string = json_encode($getFields); $sign = createPrivateAndPublicKey($data_string); $header = array(); $header[] = "Content-Type

how can i make valid signature php openssl

天涯浪子 提交于 2020-06-28 07:41:39
问题 how can i generate valid signature and how to sign request body with my private key me already try code like this but the result always signature not valid is there any other way? before asking me already searching google for solved the problem but me not yet have a corret answer function mgAccount(){ $url = "http://aaaa.com"; $getFields = [ "oaa_id" => 838, ]; $data_string = json_encode($getFields); $sign = createPrivateAndPublicKey($data_string); $header = array(); $header[] = "Content-Type