행위

Autoit curl

DB CAFE

Dbcafe (토론 | 기여)님의 2020년 4월 8일 (수) 14:55 판
thumb_up 추천메뉴 바로가기


https://www.autoitscript.com/forum/topic/162599-can-someone-please-show-me-how-to-use-curl-and-autoit/

2 autoit 적용 소스[편집]

Dim $iPidCurl = Run(@ComSpec & " /c " & 'curl -i -H' & 'Content-Type: application/x-www-form-urlencoded' & 'https://api.edmunds.com/inventory/token' & '-X POST -d ' & 'client_id=<MY SECRET ID >'&' -d ' & 'client_secret=<MY SECRET PHRASE>' & ' -d ' &'grant_type=client_credentials', @ScriptDir, @SW_HIDE,2+4)

Dim $sOut
While 1
    $sOut &= StdoutRead($iPidCurl)
    If @error Then ExitLoop
WEnd
While 1
    $sOut &= StderrRead($iPidCurl)
    If @error Then ExitLoop
WEnd
ConsoleWrite($sOut&@LF&"*********"&@LF)

3 curl 사용법[편집]

exam) https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html

본인이 테스트하려는 쿼리는 -XGET 'localhost:9200/mctest_ilhee/_analyze' -d '{ "analyzer" : "ilhee_Custom", "text"" : "this is a test"}'. 위의 값 대로 cURL 에 넣어보자! 에러가 나온다. 몇 번의 삽질.. 끝에 알아 낸 결과 ★★★★★ ' -> "로 "-> "" 로 변경을 해야한다.

ilhee_Custome 을 적용한 데이터가 잘 나오는 것을 확인할 수 있다. ilhee_Custome 은 ElasticSearch 글 내의 분석기 관련 글에서 확인할 수 있다.

cURL 은 ". ' 와 같은 부분을 잘 check 해서 쓰면 된다. cURL 사용법은" cURL --help " 로 원하는 매개변수를 잘 찾아쓰면 된다.