Jump to content

Inetget and php


Recommended Posts

hello,

i have the files to download in the web server and i can download only after php script check

now i would send this request with Inetget and download file if exist or prompt user if the file not exist

the php is like this:

CODE

<?php

if($_GET['send'] == "OK") {

...download a files

} else {

return 'no file found';

}

?>

can i use Inetget to download the file like test.exe in the @scriptdir?

thanks

Link to comment
Share on other sites

hello,

i have the files to download in the web server and i can download only after php script check

now i would send this request with Inetget and download file if exist or prompt user if the file not exist

the php is like this:

CODE

<?php

if($_GET['send'] == "OK") {

...download a files

} else {

return 'no file found';

}

?>

can i use Inetget to download the file like test.exe in the @scriptdir?

thanks

I'm not clear what your post meant.

I assume that you have a script, maybe HTML executed on a web server with some embedded php code. The files you want to transfer are also on the server and you want to get them downloaded from the server onto a PC where you are using an AutoIt script, provided the php script can tell you it's ok to do that?

If that is correct so far then could you simply have the php section check that the file exists or do whatever check you need, then echo something in a table maybe such as "File X not available" or "File X ready to download". It could be set so that iot only does that if you have set some variable in th eurl. Then your AutoIt script can read the web page and detect that message and get the file with InetGet.

Or maybe I have not understood at all :D

It might be better to get the php script to get the file downloaded for you in which case something like this might help.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

thanks martin,

you have understood my problem well, but you have an example of autoit from makes to see me

thanks

I suppose you could do something like

<?php
 if ($_GET[filewanted] != ""){
  //if the file is ok to download
 print "az97filetransfer = allowedaz98"
  //if file not ok to download
 print "az97filetransfer = forbiddenaz98"
}
else{
//do something else, eg the normal thing perhaps
}

then in the AutoIt script

#Include <string.au3>

$reply = InetgetSource($url & "?filewanted=" & $fileIwant)
$condition = _StringBetween(reply,"az97","az98")
if $condition = "allowed" then
 InetGet(......
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

thanks martin!

work fine... but inetget don't work very well...

i have tried this:

CODE

InetGet($urlDown&$fileIwant, @ScriptDir&"\testDW.exe", 1, 1)

While @InetGetActive

TrayTip("Downloading", "Bytes = " & @InetGetBytesRead, 10, 16)

Sleep(250)

Wend

MsgBox(0, "Bytes read", @InetGetBytesRead)

EndIf

but now in the @scriptdir the file testDW.exe is created but the testDW.exe filesize is 0 and the TrayTip not display on the screen

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...