Jump to content

major4579

Active Members
  • Posts

    28
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

major4579's Achievements

Seeker

Seeker (1/7)

3

Reputation

  1. @SOLVE-SMART I tried ShellExecute with the output of curl directed to a file (since ShellExecute doesn't support $STDOUT_CHILD) and it didn't work any better. @Danp2 I did try the loop after the ProcessWaitClose and it still didn't work. Thanks again to both of you! I give @mikell the credit. -John
  2. Finally, This code works: $cmd = 'C:\utility\Curl\bin\curl.exe -u username:password https://instanthousecall.com/x/admin/nccs.php?startDate=' & $sDate $iPID = Run($cmd, 'C:\utility\Curl\bin', @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($iPID) $sHTML = StdoutRead($iPID) Previously in the $cmd line I had $sDate in the end of the string as $sDate$ and in the Run command I had '$cmd$'. But for some reason I haven't figured out the Opt ("ExpandVarStrings", 1) had stopped working . Interestingly it works everywhere else as far as I can see. In fact if I add MsgBox (262144, '', '>>>$sHTML$<<<') after the last line above that works correctly! Go figure. Thanks to both Danp2 and SOLVE-SMART for sticking with me while we figured this out. BTW, who should get the credit? John
  3. @Danp2 I'll give that a try when I return - I have to run out. Thanks, John
  4. @SOLVE-SMART It's doing the same thing. If I run C:\utility\Curl\bin\curl.exe -u username:passwordhttps://instanthousecall.com/x/admin/nccs.php?startDate=2023-01-11 > D:\IHC.txt In a command window (does not matter what location I'm running it from) i works fine D:\IHC.txt contains what I need. If I run the exact same line in Autoit, D:\IHC.txt never even gets created. $cmd = 'C:\utility\Curl\bin\curl.exe -u username:password https://instanthousecall.com/x/admin/nccs.php?startDate=2023-01-11 > D:\IHC.txt' $iPID = Run('$cmd$', 'C:\utility\Curl\bin', @SW_HIDE) But if I run $cmd = 'C:\utility\Curl\bin\curl.exe -u username:password https://instanthousecall.com/x/admin/nccs.php?startDate=2023-01-11 > D:\IHC.txt' $iPID = Run($cmd, 'C:\utility\Curl\bin', @SW_HIDE) It does work. For what it's worth I do have "Opt ("ExpandVarStrings", 1) " at the beginning of my autoit file.
  5. @Danp2 I tried that but it did not work any differently then "ProcessWaitClose($iPID)" @SOLVE-SMART I was thinking of trying that - I will give it a go and report back later today or tomorrow. Have to do some real work!
  6. I've been trying to capture the output of the nccs.php file using Curl, but I cannot get it to work correctly. First here's my Autoit code. (Note: I have double checked that $sDate is correctly formatted): ;Set path to Curl $sPath = EnvGet ('PATH') $sPath = $sPath & ';C:\utility\Curl\bin\' EnvSet ('PATH', $sPath) ; Run Curl $cmd = 'curl.exe -u username:password https://instanthousecall.com/x/admin/nccs.php?startDate=$sDate$' $iPID = Run('$cmd$', "C:\utility\Curl\bin\", @SW_HIDE, $STDOUT_CHILD) ProcessWaitClose($iPID) $sHTML = StdoutRead($iPID) MsgBox (262144, '', $sHTML) Here's the display of MsgBox showing the @sHTML varaible on the last line: Now if I open a Command Window and change to the directory where Curl.exe is, and then run the exact same command line this is what I get: Note the text after "/head" in the command window. That is the text that I need to see in the Autoit script. I feel like I'm very close, but I can't figure out why it only works in the command window. Any help would be greatly appreciated! Thanks, John
  7. @mikell I got Curl to return a web page, but it's not the webpage I want. It doesn't have any of the info I want in it. The 2 things I can think of are: the credentials are not being passed properly -or- nccs.php isn't finishing before curl garbs the webpage. I will play with it when I have time. Thanks, John
  8. @Danp2 I grabbed that newer version of WinHTTP and saved it in my Includes folder. But it didn't make a difference, still cannot retrieve any data. @mikell I'll grab a copy of curl and give that a try. In your $cmd line you have: ...$sUserName & ":" & $sPassword & " " & $url Shouldn't this be: ...$sUserName & ":" & $sPassword & "@" & $url with an "@" symbol before the $url? Thanks!
  9. "GET" had been working for years. But I did try "POST" and the results were the same. I did look a little deeper and _WinHttpSimpleFormFill returned error = 4 - Connection problems. Same error as I've been getting all along. My guess is WinHTTP isn't handling the HTTPS:. or the updated Certificate. I should have included this info before: WinHTTP is ver 1.6.4.1 and the file is dated 5/19/17.
  10. One thing I've noticed in regards to Webdriver is that it's used to control a browser (unless my short look is not correct) . Since the PHP file is executed on the webserver, I would think that there would be a simple way to do this. But then again I haven't found it so that's why I'm here with my request.
  11. Because previously (using WINHTTP) I was able to select the date and then the info was displayed in a format that I coded for me to use. Now I select the date then I have to wait for the browser to open, and display the results, then I click on the webpage and the program does the rest. Really, (1) I'm just lazy and impatient (2) this is what coding is supposed to do - program the menial tasks. And (3) I was used to the data being downloaded in the background, processed and displayed. I use this program multiple times a week so yes I'd like to code the part that downloads the data.
  12. So I tried following your GIF and I'm not sure what you are showing me as far as cURL GET. It's also hard to read as the quality is poor of the GIF. Sorry. -John
  13. I'm currently using Vivaldi based on Chromium, but I can use (and have) Chrome. F12 does open DevTools. Currently, with my scrapping the screen, I basically get CSV (because that's what I copy off the screen). I have already written the code to parse pure HTML and it was pretty easy to use parts of that code parse the CSV data I am now getting. Now I'm going to make things more complicated - I used to be able to do this with the WINHTTP UDF, but they upgraded the website security and that broke the way I was receiving the info. I was getting pure HTML code, but now I get nothing, i.e., no data returned. For your info here's the code that used to work. So I'm looking for an alternative way to get the data. ; $sAddress is the base URL ; $sDate is the starting date to retrieve the data ; $sUserName and $sPassword are login credentials ; $sHTML is a global text variable and is used to return the entire page #include <WinHttp.au3> #include <WinHttpConstants.au3> $sForm = _ '<form action="' & $sAddress & '" method="get">' & _ ' <input name="startDate"/>' & _ ; '</form>' ; Initialize and get session handle $hOpen = _WinHttpOpen() $hConnect = $sForm ; will pass form as string so this is for coding correctness because $hConnect goes in byref ; Fill form $sHTML = _WinHttpSimpleFormFill($hConnect, $hOpen, _ Default, _ "name:startDate", $sDate, _ "[CRED:" & $sUserName & "," & $sPassword & "]") If (@error) Then $nError = @error Return 0 EndIf ; Close handles _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) I will need to study your GIF to see if it's something I can use. Thank you. John
  14. I started looking at Webdriver and it seems to be a lot more complex then should be needed for my needs. But if this is the only way to get the output of a PHP file then I will study and try to implement it. There seem to be a lot of resources available. So my question: is this the simplest and best way to go about doing what I'm doing as described in my previous message? I only need to load the entire page (HTML or screen copy) into a text variable. I have already written the code to process that. Thanks again, John
  15. @SOLVE-SMART What the program I wrote does is open a browser with the link I showed above. The php file then displays the following: The program pauses for me to click in the display. It then selects all (^a) and copies it (^c) and then processes the data as I want. As I said - not very elegant. And requires my input. Ok so your saying I can do this with webdriver? Where do I find more info about webdriver and autoit? Is there a UDF for Webdriver or do I need to use the API interface? Thanks, John
×
×
  • Create New...