curl-converter icon indicating copy to clipboard operation
curl-converter copied to clipboard

Create insecure request

Open eldario opened this issue 1 year ago • 0 comments
trafficstars

Problem

I'm trying to enter the command on https://laravelshift.com/convert-curl-to-http

curl --insecure -X POST http://example.com -H 'User: AAA' -d '{"data":"some"}'

Result of this:

Http::withBody('{"data":"some"}')
    ->withHeaders([
        'User' => 'AAA',
    ])
    ->post('http://example.com');

Expected Result

Http::withBody('{"data":"some"}')
    ->withoutVerifying()
    ->withHeaders([
        'User' => 'AAA',
    ])
    ->post('http://example.com');

The same situation with the `-k flag

curl -k -X POST http://example.com -H 'User: AAA' -d '{"data":"some"}'

Result of this: изображение

Expected Result

Http::withBody('{"data":"some"}')
    ->withoutVerifying()
    ->withHeaders([
        'User' => 'AAA',
    ])
    ->post('http://example.com');

From https://curl.se/docs/sslcerts.html

Tell libcurl to not verify the peer. With libcurl you disable this with curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);

With the curl command line tool, you disable this with -k/--insecure.

eldario avatar Mar 01 '24 13:03 eldario