Jump to content

Search the Community

Showing results for tags 'Post'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 18 results

  1. Hi mates, well this is my first contribution. a simple UDF to use Virustotal API v2.0 The response return is not parsed|splitted. requires >WinHttp UDF Functions List: Update: Now a Only Function using a flags for respective mode. VT() Use respective flag($Type) VT(ByRef $aAPI, $Type, $sResource, $sAPIkey,$Comments="") flags($Type) $fReport = retrieve a scan report on a given file $fScan = submit a file for Scanning $fRescan = Rescan files in VirusTotal's file store $uReport = retrieve a scan report on a given URL $uScan = submit a URL for Scanning $Comment = Make a commnet on files and URLs Example: #include <Crypt.au3> #include "VT.au3" Example() Func Example() _Crypt_Startup() Local $sFilePath = @WindowsDir & "\Explorer.exe" Local $bHash = _Crypt_HashFile($sFilePath, $CALG_MD5) _Crypt_Shutdown() Local $hVirusTotal = VT_Open() Local $APIkey='Your API key' ConsoleWrite(VT($hVirusTotal, $fReport, '20c83c1c5d1289f177bc222d248dab261a62529b19352d7c0f965039168c0654',$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $fScan, $sFilePath,$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $fRescan, hex($bHash),$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $uReport, "http://www.virustotal.com",$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $uScan, "http://www.google.com",$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $Comment, hex($bHash) ,$APIkey,"Hello Word | Hola Mundo") & @CRLF) VT_Close($hVirusTotal) ; EndFunc ;==>Example Saludos VT.au3
  2. Ciao, This example reproduces the problem I encounter when sending a post request to an echo server. Instead of being sent as text utf8, the data is transmitted base64 encoded. Example: - json String: '{"firstName":"Jonathan","lastName":"Freeman","loginCount":4,"active": "yes","text":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel volutpat nunc. Maecenas id tempus mi. Morbi ipsum enim, ultricies ac augue sit amet, ullamcorper finibus ex. Vestibulum vel posuere nibh, nec faucibus eros. Nam malesuada non lacus a suscipit. Nulla rhoncus tempus mi quis placerat. Curabitur commodo tincidunt justo quis sollicitudin."}' - server response: "data:application/octet-stream;base64,AAAAALgE6QNYAIAAAgAAANQCAAAAAAAAWF8AAAAAAAD0VQAAAAAAAD9APQAAAAAAAwAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAABBAAAAAAABRUAAAAmIZwcAbRt8/LMa9UAAAAAAAAAAGFzIGlkIHRlbXB1cyBtaS4gTW9yYmkgaXBzdW0gZW5pbSwgdWx0cmljaWVzIGFjIGF1Z3VlIHNpdCBhbWV0LCB1bGxhbWNvcnBlciBmaW5pYnVzIGV4LiBWZXN0aWJ1bHVtIHZlbCBwb3N1ZXJlIG5pYmgsIG5lYyBmYXVjaWJ1cyBlcm9zLiBOYW0gbWFsZXN1YWRhIG5vbiBsYWN1cyBhIHN1c2NpcGl0LiBOdWxsYSByaG9uY3VzIHRlbXB1cyBtaSBxdWlzIHBsYWNlcmF0LiBDdXJhYml0dXIgY29tbW9kbyB0aW5jaWR1bnQganVzdG8gcXVpcyBzb2xsaWNpdHVkaW4uIn0=" How can I go about transmitting data in text format utf8? Thanks in advance for the help. In the zip file: - CurlJsonPost.au3: this script - Curl.au3: UDF by Ward (thank you!) - data.json: json srting for command line test Note: using Curl.exe with json string saved in a file (utf8 encoded) named data.json, works perfectly To try with the command line tool: - save data.json in curl\bin directory - open cmd.exe and cd to curl\bin directory - Enter the following command: curl -H "Content-Type: application/json" --data @data.json https://httpbin.org/post #Include "Curl.au3" Global $_cURL_OutputBuffer Local $sJson = '{"firstName":"Jonathan","lastName":"Freeman","loginCount":4,"active": "yes","text":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel volutpat nunc. Maecenas id tempus mi. Morbi ipsum enim, ultricies ac augue sit amet, ullamcorper finibus ex. Vestibulum vel posuere nibh, nec faucibus eros. Nam malesuada non lacus a suscipit. Nulla rhoncus tempus mi quis placerat. Curabitur commodo tincidunt justo quis sollicitudin."}' Local $iRetCode, $sServerResponse ConsoleWrite("=== Json post test ===" & @LF) ConsoleWrite(StringFormat("Retcode: %s - %s", $iRetCode, Curl_Easy_strerror($iRetCode)) & @LF) ConsoleWrite("Data returned from server" & @LF & @LF) $sServerResponse = JsonPost_Test($sJson, $iRetCode) ConsoleWrite($sServerResponse & @LF) Func JsonPost_Test($sJson, ByRef $iRetCode) ; Init Easy Curl Interface e set url (echo service) Local $oCurl = Curl_Easy_Init() curl_easy_setopt($oCurl, $CURLOPT_URL, "https://httpbin.org/post") ; Set content type header Local $headers = curl_slist_append(0, "Content-Type: application/json") curl_easy_setopt($oCurl, $CURLOPT_HTTPHEADER, $headers) ; Post fields & size curl_easy_setopt($oCurl, $CURLOPT_POSTFIELDS, $sJson) curl_easy_setopt($oCurl, $CURLOPT_POSTFIELDSIZE, StringLen($sJson)) ; Set callbac function to get server response back (see global var $_cURL_OutputBuffer) $hWriteFunc = DllCallbackRegister("WriteFunc_CallBack", "uint:cdecl", "ptr;uint;uint;ptr") curl_easy_setopt($oCurl, $CURLOPT_WRITEFUNCTION, DllCallbackGetPtr($hWriteFunc)) ; Ignore ssl certificates check curl_easy_setopt($oCurl, $CURLOPT_SSL_VERIFYPEER, 0) curl_easy_setopt($oCurl, $CURLOPT_SSL_VERIFYHOST, 0) ; Execute the post request $iRetCode = curl_easy_perform($oCurl) ; Set return trasfer & clear output buffer global var Local $sReturnTransfer = $_cURL_OutputBuffer $_cURL_OutputBuffer = "" Return SetError(0, 0, $sReturnTransfer) EndFunc Func WriteFunc_CallBack($ptr,$nSize,$nMemb,$pStream) Local $vData = DllStructCreate ("byte[" & $nSize*$nMemb & "]",$ptr) $_cURL_OutputBuffer &= BinaryToString(DllStructGetData($vData,1)) Return $nSize*$nMemb EndFunc curlJsonPost.zip
  3. A little help here please !? I'm trying to parse a file but the function is not working well! i think there is some thind doing wrong at FileRead() Obs: username,password and API link below is fictitious ConsoleWrite(">POST METHOD UPLOADING LOCAL IMAGE<" & @CRLF) _PostMethodTest() Func _PostMethodTest() Local Const $sAPIKey = '8f1e0a750088957' Local $sBoundary = "--------Boundary" Local $sHeaders = "Content-Type: multipart/form-data; boundary=" & $sBoundary & @CRLF Local $sData = '' Local $sFileName="image.jpg" Local $sFilePath="C:\Users\DELL\Desktop\" & $sFileName Local $hFile=FileOpen($sFilePath,16);16=$FO_BINARY Local $sFileData=FileRead($hFile) FileClose($hFile) $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="myImage"; filename="' & $sFileName & '"' & @CRLF $sData &= 'Content-Type: application/upload' & @CRLF & @CRLF $sData &= BinaryToString($sFileData,0) & @CRLF $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="username"' & @CRLF & @CRLF $sData &="myuserName" & @CRLF $sData &= "--" & $sBoundary & @CRLF $sData &= 'Content-Disposition: form-data; name="password"' & @CRLF & @CRLF $sData &="MyPassword" & @CRLF $sData &=$sBoundary & "--" ConsoleWrite($sData) Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://myapi", False) $oHTTP.SetRequestHeader("Content-Type", "multipart/form-data; " & "boundary=" & $sBoundary) $oHTTP.SetRequestHeader("apikey", $sAPIKey) $oHTTP.Send(StringToBinary($sData,1)) Local $sReceived = $oHTTP.ResponseText ConsoleWrite($sReceived & @CRLF) EndFunc ;==>_PostMethodTest
  4. I'm trying to get data from http://poe.trade/ - disclaimer, although this site is about a game, my script will not in any way interact directly with the game in any way. The script is just to get data from the site. To explain how it works - you submit a POST request and a custom URL is returned, then you do a GET request on that URL and you get the final URL you want. First issue: Now, I've tried doing so by using https://apitester.com/ and the first phase works. Here's how it looks like at APITester: Request Headers POST /search HTTP/1.1 Host: poe.trade Accept: */* User-Agent: Rigor API Tester Content-Length: 43 Content-Type: application/x-www-form-urlencoded Request Body online=x&name=kaom%27s%20heart&league=incursion When I submit this, the response I get is this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>Redirecting...</title> <h1>Redirecting...</h1> <p>You should be redirected automatically to target URL: <a href="http://poe.trade/search/ioritewoteteme">http://poe.trade/search/ioritewoteteme</a>. If not click the link. So I then do a GET request for 'http://poe.trade/search/ioritewoteteme', which results in this response: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>Redirecting...</title> <h1>Redirecting...</h1> <p>You should be redirected automatically to target URL: <a href="http://poe.trade/search/inamotezuakito">http://poe.trade/search/inamotezuakito</a>. If not click the link. Great, this link (http://poe.trade/search/inamotezuakito) is exactly what we want. However, when I try to do the same in autoit, the result is quite different: Global Const $HTTP_STATUS_OK = 200 $test = HttpPost("http://poe.trade/search", "/online=x&name=kaom%27s%20heart&league=incursion") ClipPut($test) MsgBox(1, "", $test) Func HttpPost($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("POST", $sURL, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.SetRequestHeader("Host", "poe.trade") $oHTTP.SetRequestHeader("User-Agent", "Rigor API Tester") $oHTTP.SetRequestHeader("Accept", "*/*") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send($sData) If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc The code above returns: ' 謟 ' Any ideas as to what I am doing incorrectly? Second issue: Once I get the final link using APITester and do a GET on that i get a bunch of hieroglyphs. A friend of mine advised that the data is GZiped, which is a pain in the butt to be honest. However, apparently curl can uncompres that. How would I go about it? Thanks
  5. Hi All i am currently trying to add a function to my project that can send SMS, i have gone with Twilio for the sms service that use a REST API. I have never worked with an API before, and could use some help. I can get my function working with using cURL.exe and copy past command from the website with the following code. And thats great unfortunately i am have issue with character like æøå when sending a SMS appears like a box or ?. this does not happen if i do it from the website so it looks like a Unicode issue in curl.exe. I have done some searching on the forum and understand that i should be able to implement this curl command with the WinHTTP UDF from @trancexx so i don't need a third part exe and it might fix my charater issue. Unfortunately i really don't understand how i am to change curl commands to the WinHTTP and i was hoping some good maybe give me an example i could learn from. Thanks in advanced i have removed the AuthToken number from the script. _SendSMS("00000000","SomeOne","SMS body info") Func _SendSMS($SendTo,$SendFrom,$Msgtxt) $AccountSID = "ACbb765b3180d5938229eff8b8f63ed1bc" $AuthToken = "Auth Token number" $Data = '"https://api.twilio.com/2010-04-01/Accounts/'&$AccountSID&'/Messages.json"'& _ '-X POST \ --data-urlencode "To=+45'&$SendTo&'" \ --data-urlencode "From='&$SendFrom&'" \ --data-urlencode "Body='&$Msgtxt&'" \ -u '&$AccountSID&':'&$AuthToken&'' ShellExecute(@ScriptDir&"\curl.exe","-k "&$Data) ;~ curl 'https://api.twilio.com/2010-04-01/Accounts/ACbb765b3180d5938229eff8b8f63ed1bc/Messages.json' -X POST \ ;~ --data-urlencode 'To=+4500000000' \ ;~ --data-urlencode 'From=Reception' \ ;~ --data-urlencode 'Body=Test Body' \ ;~ -u ACbb765b3180d5938229eff8b8f63ed1bc:[AuthToken] EndFunc
  6. Hello there, could anyone advanced in WinHTTP tell me what am I missing please? #include "WinHttp.au3" #include <Array.au3> $sPic = "C:\Users\Source\Pictures\Capturex1.PNG" $sPic2 = "C:\Users\Source\Pictures\Capturex2.PNG" $hOpen = _WinHttpOpen() $hConnect = _WinHttpConnect($hOpen, "https://m.facebook.com/") $sRead = _WinHttpSimpleFormFill($hConnect, "login.php", "login_form", "name:email", "login@mail.com", "name:pass", "pasword") $aRead = _WinHttpSimpleFormFill($hConnect, "/groups/1111111111111", "index:1", "name:view_photo", True, "[RETURN_ARRAY]") ;<-- 11111... <-- Group ID $aURL = _WinHttpCrackUrl($aRead[2]) $aRead = _WinHttpSimpleFormFill($hConnect, $aURL[6] & $aURL[7], Default, "name:file1", $sPic, "[RETURN_ARRAY]") $aURL = _WinHttpCrackUrl($aRead[2]) $aRead = _WinHttpSimpleFormFill($hConnect, $aURL[6] & $aURL[7], "index:0", "name:view_photo", True, "[RETURN_ARRAY]") ;<-- Suppose to press on Add More photos isn't? $aURL = _WinHttpCrackUrl($aRead[2]) $aRead = _WinHttpSimpleFormFill($hConnect, $aURL[6] & $aURL[7], Default, "name:file1", $sPic2, "[RETURN_ARRAY]") ; <-- also submit second photo? $aURL = _WinHttpCrackUrl($aRead[2]) _WinHttpSimpleFormFill($hConnect, $aURL[6] & $aURL[7], Default, "name:view_post", True) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) I'm trying to post multi photos in group, but no luck. Here is idea I came from:
  7. Hi everyone, I have a script that call this function again & again normaly Func CallAPI($amount, $target, $condition, $API_key) $oHTTP.Open("POST","https://HOST?api_key="&$API_key) $oHTTP.SetRequestHeader('content-type','application/json') $oHTTP.Send('{"amount":'&$amount&',"target":'&$target&',"condition":"'&$condition&'"}') $Response = $oHTTP.ResponseText Return $Response EndFunc but sometime (may be after 105 request, 203 request, 1000 request, ... n request) this request error and make my script stop $oHTTP.Send('{"amount":'&$amount&',"target":'&$target&',"condition":"'&$condition&'"}') $oHTTP.^ ERROR I think sever response slow that make this request reached default timeout. I try to set time out with hope if reached timeout this request will return error or something else and my script keep run continue $oHTTP.SetTimeouts(30000,60000,30000,30000) but it when request reached timeout, my script error, exit and return the same message above. Anyone have any idea too fix this disadvantage, or when sever response slow it will skip this request and return error code and countinue code without exit? Thanks everyone T.T
  8. Have this following input parameter(Complex list of inputs) that need to be SEND as part of HTTP POST Request. Have been searching forums to find an AutoIT equivalent to enapsulate the following data, but unsuccessful. Below given Working Code is failing with 400-Bad Request for obvious reason of incomplete input - unable to send ip_list and other array type parameters Questions: 1. How to encapsulate the below given data for $oHttp.Send() 2. How to enapsulate special data types like null - aligned_device_tempate parameter White sapced values - () and empty array? - hostname or device_groups Input Parameter in JSON format to be converted & sent in AutoIT compatible {       "name": "SnmpSIM",       "description": "EM7 device created by BDD test case",       "credentials":"{{feature.credential.body.result_set[*].URI}}",        "organization": "/api/organization/0",       "aligned_device_template": null,       "aligned_collector": "{{feature.appliance_id[0].id[0]}}{{feature.appliance_id[0].id[1]}}",       "discover_non_snmp": "1",       "scan_ports": [         "21",         "22",         "23",         "25",         "80"       ],       "ip_lists": [         {         "start_ip": "{{feature.json.ip}}",         "end_ip": "{{feature.json.ip}}"         }       ],       "dhcp_enabled": "0",       "duplicate_protection": "1",       "model_device": "1",       "log_all": "1",       "scan_all_ips": null,       "port_scan_timeout": null,       "initial_scan_level": null,       "scan_throttle": null,       "interface_inventory_timeout": "600000",       "max_interface_inventory_count": "10000",       "bypass_interface_inventory": "0",       "hostnames": [],       "device_groups": []     } Working Code ; The data to be sent $sPD = 'name=SnmpSIM&description=EM7 device created by BDD test case&credentials=37&organization=/api/organization/0&aligned_device_template=null&aligned_collector=1&discover_non_snmp=1&dhcp_enabled=0&duplicate_protection=1&model_device=1&log_all=1&scan_all_ips= null&port_scan_timeout= null&initial_scan_level= null&scan_throttle= null&interface_inventory_timeout=600000&max_interface_inventory_count=10000&bypass_interface_inventory=0&hostnames=&device_groups=&scan_ports=21' ; Creating the object $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "http://10.2.4.18/api/discovery_session", False) $oHTTP.SetCredentials("username","password",0) $oHTTP.SetRequestHeader("Content-Type", "application/em7-resource-uri") ; Performing the Request $oHTTP.Send($sPD) ; Download the body response if any, and get the server status response code. $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status If $oStatusCode <> 200 then  MsgBox(4096, "Response code", $oStatusCode) EndIf ; Saves the body response regardless of the Response code  $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists  FileWrite($file, $oReceived)  FileClose($file) SAMPLE VBA CODE for Reference  Dim Items As New Collection  Dim Item As Dictionary  Dim Id As Long  For Id = 1 To 2      Set Item = New Dictionary      Item("iditem") = Id      Item("amount") = 1      Items.Add Item  Next Id  Request.AddBodyParameter "id", 5633  Request.AddBodyParameter "items", Items $oDictionary = ObjCreate("Scripting.Dictionary") $oDictionary.ADD("start_ip", "10.20.7.31") $oDictionary.ADD("end_ip", "10.20.7.33")
  9. Create Postage Stamp from any images. Transparency is preserved around serrated edges for permit to paste stamp. Downloads are available in the download section Hope you like it ! Edit : The glue is not supplied with the stamp!
  10. Version 1.0.4

    343 downloads

    Postage Stamp Builder
  11. Hello, I'm in the making of a script that needs to post XML data through HTTPS to our ServiceDesk Plus MSP service. I'm running into trouble because I have never made any scripts using HTTP with POST and I cannot see what I'm doing wrong here. Can someone help me or should I find help somewhere else? $URLSDP="" ;REMOVED - cannot publish this. this is the HTTPS url to our ServiceDesk $TechnicianKey="" ;REMOVED $ID="" ; Request ID $sPostData = "OPERATION_NAME=ADD_NOTE&INPUT_DATA=<Operation><Details><Notes><Note><isPublic>false</isPublic><notesText>Text added to the note</notesText></Note></Notes></Details></Operation>&format=XML" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $URLSDP & "/sdpapi/request/"& $ID & "/note?TECHNICIAN_KEY="& $TechnicianKey, False) $oHTTP.SetRequestHeader("Content-Type", "xml") $oHTTP.Send($sPostData) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status ConsoleWrite($oStatusCode & @CRLF) ConsoleWrite($oReceived & @CRLF) If $oStatusCode = 200 Then ;Process the response $oReceived ;ConsoleWrite(@CRLF & "Response" & @CRLF & $oReceived & @CRLF) Else MsgBox(16, "Error " & $oStatusCode, $oReceived, 7) EndIf Response: <operation name="POST"><result><status>Failed</status><message>Invalid operation</message></result></operation>REST API guide. https://www.manageengine.com/products/service-desk-msp/help/adminguide/api/notes-operations.html#add
  12. Dear AutoIt Community, I have checked some HTTP examples in the forums. So, I created a basic script as the following: $login = ObjCreate("winhttp.winhttprequest.5.1") $sUsername = "ty" $sPassword = "AAbb11!!" Local $url = "http://192.168.182.160:9889/authenticate.action" $login_packet = "username=" & $sUsername & "&password=" & $sPassword & "&vcode=0000&dstInfo=300%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0&language=en_US&name=default" $login.open("POST", $url) $login.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $login.send($login_packet) $login.WaitForResponse() $cookies = $login.GetAllResponseHeaders() ConsoleWrite($cookies & @CRLF)Actually, the username and password is correct. I got the following response: Cache-Control: no-store,no-cache Date: Wed, 27 May 2015 12:33:22 GMT Content-Length: 95 Content-Type: text/plain;charset=UTF-8 Server: OpenAS Set-Cookie: session_cookie=34431a76-54d5-498f-aae2-866dd5199304; Path=/; HttpOnly Set-Cookie: JSESSIONID=3FCE7FEE16230EF25BD2DFA280958212; Path=/; HttpOnlyIf I change the username or password, I want to a failed login, I got this: Cache-Control: no-store,no-cache Date: Wed, 27 May 2015 12:34:25 GMT Content-Length: 87 Content-Type: text/plain;charset=UTF-8 Server: OpenAS Set-Cookie: session_cookie=01a233ed-a008-496a-89b1-0d044d03949a; Path=/; HttpOnly Set-Cookie: JSESSIONID=4350A7C51D6C0E7F294ED9D6E08DB9A6; Path=/; HttpOnlyOnly the session cookie and session ID is changed. But there is no result whether I failed to login. Here is the successful HTTP result: http://192.168.182.160:9889/authenticate.action POST /authenticate.action HTTP/1.1 Host: 192.168.182.160:9889 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0 Accept: */* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Content-Type: application/x-www-form-urlencoded;charset=UTF-8 X-Requested-With: XMLHttpRequest Referer: http://192.168.182.160:9889/login.action?ssoLogin=true Content-Length: 148 Cookie: session_cookie=77e59d47-fa86-4ce4-87c2-8486e68c7dbd; JSESSIONID=05788845F16A110B6C7747DFDB9B7F3F; bme_locale_session=en_US; sna_cookie=; locale_cookie=en_US; access_time_cookie=0 Connection: keep-alive Pragma: no-cache Cache-Control: no-cache username=ty&password=AAbb11!!&vcode=0000&dstInfo=300%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0&language=en_US&name=default HTTP/1.1 200 OK Cache-Control: no-store,no-cache Set-Cookie: session_cookie=99e86bd3-6308-4ce1-ab29-960aa69147e9; Path=/; HttpOnly Set-Cookie: sna_cookie=99e86bd3-6308-4ce1-ab29-960aa69147e9; Path=/; HttpOnly Set-Cookie: locale_cookie=en_US; Expires=Fri, 26-Jun-2015 10:31:48 GMT; Path=/ Set-Cookie: JSESSIONID=56472DD2CEBF17A3218C3765585380A9; Path=/; HttpOnly Content-Type: text/plain;charset=UTF-8 Content-Length: 49 Date: Wed, 27 May 2015 10:31:47 GMT Server: OpenASHere is the failed HTTP result: http://192.168.182.160:9889/authenticate.action POST /authenticate.action HTTP/1.1 Host: 192.168.182.160:9889 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0 Accept: */* Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Content-Type: application/x-www-form-urlencoded;charset=UTF-8 X-Requested-With: XMLHttpRequest Referer: http://192.168.182.160:9889/login.action?ssoLogin=true Content-Length: 149 Cookie: session_cookie=acec9a18-b702-4f7b-96c6-667a7b35ac08; JSESSIONID=4211585FF6FE3DFC19FEF39196DCB61A; bme_locale_session=en_US Connection: keep-alive Pragma: no-cache Cache-Control: no-cache username=ty&password=dsadsadsa&vcode=0000&dstInfo=300%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0%3A0&language=en_US&name=default HTTP/1.1 200 OK Cache-Control: no-store,no-cache Content-Type: text/plain;charset=UTF-8 Content-Length: 111 Date: Wed, 27 May 2015 11:21:43 GMT Server: OpenAS As I see, the successful result includes cookies and session ID; but failed result doesn't include these. I wonder why the result of the script for failed attempt still showing session ID. Can you please tell me what to modify in my script in order not to get session ID when login failed? Any comments are welcome, thanks.
  13. So I have a bit of code where I'm sending a (very large) xml string via a POST command to a site. Except, I think it's timing out. Not quite sure, perhaps it's not, and I just have it written wrong? All I get in SCITE is Error in this kind of orange text (not the usual black). My responsetext and status and statustext don't come back as anything, so I'm kind of at a loss as to how to troubleshoot past this. Anyone have an idea for me? (I had to hide the site and dbid in the quickbase URL as it's my company, so I can't post it for confidentiality reasons). $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", http://<mysite>.quickbase.com/<mydbid>, False) $oHTTP.SetRequestHeader("Content-Type", "application/xml") $oHTTP.SetRequestHeader("QUICKBASE-ACTION", "API_ImportFromCSV") $oHTTP.Send($xmlStr) $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status ConsoleWrite(IsObj($oReceived) & @CRLF) ConsoleWrite(IsObj($oStatusCode) & @CRLF) ConsoleWrite($oStatusCode & @CRLF) ConsoleWrite($oReceived & @CRLF) the $xmlStr is an XML string / file that is 62MB...I'm thinking the size is part of the problem, but I really can't cut it down. I'm hoping I can just find a way to retrieve a status for when it timed out or didn't work or something, but since I'm getting nothing except that weird orange Error in Scite, not quite sure what to do.
  14. I'm having a hard time trying to set a value in a specific JavaScript textarea... And I think, this is the right time.. Is it possible to set a value in the "Join the discussion…" textarea and simulate the mouse click of the "Post as {USERNAME}" button of the web page that have added a Disqus forum? If they are possible then: How can I set a value in the "Join the discussion…" textarea? And how to simulate the mouse click of the "Post as {USERNAME}" button? Note: Before you can see the "Post as {USERNAME}" button, you must be sign in with Disqus first! This is the (NULL) previous test work that I've done: #include <IE.au3> $oIE = _IECreate("http://professionalserver.tk/php/wp/hello-world/", 0, 1, 1, 0) Sleep(10000) $disqus_thread = $oIE.document.getElementById("disqus_thread") $textarea = $disqus_thread.getElementsByClassName("textarea").innerHTML = "Example Message" _IELinkClickByText($oIE, "Post as") Here is my test blog that have a Disqus thread: http://professionalserver.tk/php/wp/hello-world/ Here is the other web page that have it: http://www.voicesofyouth.org/es/posts/oneminutesjr---syria-my-love- Here is the other one: http://comercioexterior.gob.ec/min-rivadeneira-participo-en-evento-experience-ecuador-love-life-en-dubai/ And also make sure that the script will also work in any page that have a Disqus thread..
  15. I'm in the middle of converting somthing into autoit and I hit a snag.. dojo.rawXhrPost({ url: webServiceURL, handle: handler, headers: { "Content-Type": "text/xml; charset=utf-8", "cache-control": "no-cache" }, postData: this.BuildXMLString(), timeout: 0, sync: bSync }); Ahh, POST, my old Nemesis. I've tried (and failed!) several different things to do what this does using _WinHttp UDF but have had no luck. How do you send raw post data with Autoit? Is it possible?
  16. Hi All, Long time no post - the forum has changed a lot since I was last here! Hope you are all ok. Anyway, the reason I'm here is because I'm writing a program that needs to post a Tweet to a Twitter account. I am using the >Twitter UDF, which I have already adapted slightly so that once a user has logged in once the username and password is not need because the OAuth token and OAuth token secret is stored and used again, rather than regenerating a them each time the program is launched. However, since the UDF was last updated Twitter has updated their API and retired the use of XML so now the response is only given in JSON. Fortunately, to get the UDF tweeting again it was simply a case of changing the URL that the data was POSTed to. However, because IE doesn't actually render/display JSON files, whenever the data is sent a File Download dialog appears asking to download the JSON file that is returned. Does anyone know a way around this to stop the dialog appearing, other than sending a keypress when the window is detected? Thanks in advance
  17. Hi Guys, I'm trying to do a HTTP POST which would change a setting on my server. (details here, enable recordings etc.) When I use the full URL via a browser it works fine, when I use the script below, it fails. #include <http.au3> $Host = "192.168.20.5" $Port = "5000" $File = "/ivr/PbxAPI.aspx" $PostData = "func=upd_ext&extnum=3888&pwd=123456!&record_calls=0" $Socket = _HTTPConnect($Host, $Port) _HTTPPost($Host, $File, $Socket, _HTTPEncodeString($PostData)) _HTTPClose($Socket) I assume I'm doing something wrong, I can't figure out what :-) Any suggestions are appreciated. Thanks!!
  18. I was working on a solution for adamchapman on his topic here. I was able to make the option change quite easily, but downloading the file is a different story. AutoIt Code to change select option I reviewed the function tied to the change event. This same function is called when you click the download link. The only difference is the argument is false and true respectively. I removed the code that is executed when false as it is not relevant for the issue. It basically builds a string with the selected option value + true + symbol (Example: 5d|true|AA), then sets the value of the input that has an id ending in submitString and submits the form. function getQuotes(download) { if(!download) showLoadingSpinner(); var data = $("[id$='ddlTimeFrame']").val(); var submitString = data + '|' + download + "|" + quoteBoxSelectedSymbol; if (!download) { <!-- Removed --> } else { $("[id$='submitString']").val(submitString); $("#getFile").submit(); } } - Now we move on to the form that is submitted by the getQuotes function. The input with id "quotes_content_left_submitString" is the input that will have the value set from the previous function. <form id="getFile" method="post" action="http://www.nasdaq.com/symbol/aa/historical" lpsubdone="1"> <div class="aspNetHidden"> <input id="__VIEWSTATE" name="__VIEWSTATE" value="TRIMMED" type="hidden"> </div> <div class="aspNetHidden"> <input id="__VIEWSTATEENCRYPTED" name="__VIEWSTATEENCRYPTED" value="" type="hidden"> <input id="__EVENTVALIDATION" name="__EVENTVALIDATION" value="FslL5mK8EfHMdRmVPirjPRHx0rzoR4ZblfHZcyVf/H6sJ58PbPdR2nXwJige52KEPcse4Wp37klD+PDrLXkhysNoAbltd+CEe5ntj67kFmk=" type="hidden"> </div> <input id="quotes_content_left_submitString" name="ctl00$quotes_content_left$submitString" value="" type="hidden"> </form> - I believe this can be easily solved using WinHTTP, however I don't have a good understanding of that library currently. I did use Fiddler to capture the request and response that are generated when downloading the file. Request Response - I'd like to get the csv file downloaded using WinHTTP, but the main purpose of this is to learn how to use WinHTTP.
×
×
  • Create New...