Originally posted by Gary Beene
View Post

http://newvisionconcepts.com/subscriptions.php?param1=testvalue
#COMPILE EXE #DIM ALL #INCLUDE "httprequest.inc" ENUM ctrls SINGULAR IDC_btnAction= 1001 IDC_URL IDC_Params IDC_lbl1 IDC_lbl2 END ENUM FUNCTION PBMAIN() AS LONG LOCAL lRslt AS LONG DIALOG DEFAULT FONT "consolas",12 LOCAL hDlg AS DWORD DIALOG NEW 0, EXE.FULL$, , , 350, 80, %WS_SYSMENU, TO hDlg CONTROL ADD LABEL , hDlg,%IDC_lbl1,"URL",10,10,40,14 CONTROL ADD LABEL , hDlg,%IDC_lbl2,"Params",10,25,40,14 CONTROL ADD TEXTBOX , hDlg,%IDC_URL,"",50,10,280,14 CONTROL ADD TEXTBOX , hDlg,%IDC_Params,"",50,25,280,14 CONTROL ADD BUTTON , hDlg,%IDC_btnAction,"Test POST",60,40,80,20 DIALOG SHOW MODAL hDlg, CALL MainDlgCB TO lRslt END FUNCTION CALLBACK FUNCTION MainDlgCB() LOCAL wsUrl,wsRequest,wsReturn AS WSTRING LOCAL lResult AS LONG SELECT CASE AS LONG CB.MSG CASE %WM_COMMAND SELECT CASE AS LONG CB.CTL CASE %IDC_btnAction IF CB.CTLMSG = %BN_CLICKED OR CB.CTLMSG = 1 THEN CONTROL GET TEXT CB.HNDL,%IDC_URL TO wsURL CONTROL GET TEXT CB.HNDL,%IDC_Params TO wsRequest lResult = lResult = PostReq(wsUrl,wsRequest,wsReturn) IF lResult > 0 THEN ? STR$(lResult) & ": " & wsReturn,%MB_ICONERROR,"POST Error" ELSE ? wsReturn,,"POST OK" END IF END IF END SELECT END SELECT END FUNCTION FUNCTION PostReq(wsURL AS WSTRING, wsRequest AS WSTRING,wsReturn AS WSTRING) AS LONG DIM pHttpReq AS IWinHttpRequest pHttpReq = NEWCOM "WinHttp.WinHttpRequest.5.1" IF ISNOTHING(pHttpReq) THEN wsReturn = "WinHttpRequest.5.1 failure" :FUNCTION = 1:EXIT FUNCTION TRY pHttpReq.Open "POST", wsURL, 0 pHttpReq.SetRequestHeader "Content-Type","application/x-www-form-urlencoded" pHttpReq.Send(wsRequest) IF pHttpReq.StatusText <> "OK" THEN IF pHttpReq.StatusText = "" THEN wsReturn = "No response From Server" : FUNCTION = 2:EXIT FUNCTION ELSE wsReturn = "Server returned: " & pHttpReq.StatusText:FUNCTION = 3:EXIT FUNCTION END IF ELSE 'success wsReturn = pHttpReq.Responsetext END IF CATCH wsReturn = "COM Error"& $LF & HEX$(OBJRESULT,8) & ": " & OBJRESULT$() FUNCTION = 4 END TRY END FUNCTION '
$serialnumber = $_POST["param1"]; echo $serialnumber; exit;
FUNCTION PostReq(wsURL AS WSTRING, wsRequest AS WSTRING,wsReturn AS WSTRING) AS LONG DIM pHttpReq AS IWinHttpRequest pHttpReq = NEWCOM "WinHttp.WinHttpRequest.5.1" IF ISNOTHING(pHttpReq) THEN wsReturn = "WinHttpRequest.5.1 failure" :FUNCTION = 1:EXIT FUNCTION TRY pHttpReq.Open "POST", wsURL, 0 pHttpReq.SetRequestHeader "Content-Type","application/x-www-form-urlencoded" pHttpReq.Send(wsRequest) IF pHttpReq.StatusText <> "OK" THEN IF pHttpReq.StatusText = "" THEN wsReturn = "No response From Server" : FUNCTION = 2:EXIT FUNCTION ELSE wsReturn = "Server returned: " & pHttpReq.StatusText:FUNCTION = 3:EXIT FUNCTION END IF ELSE 'success wsReturn = pHttpReq.Responsetext END IF CATCH wsReturn = "COM Error"& $LF & HEX$(OBJRESULT,8) & ": " & OBJRESULT$() FUNCTION = 4 END TRY END FUNCTION '
FUNCTION PBMAIN() LOCAL wsurl,wsRequest,wsReturn AS WSTRING LOCAL lResult AS LONG wsURL = "http://newvisionconcepts.com/subscriptions.php" wsRequest = "param1=testvalue" lResult = PostReq(wsUrl,wsRequest,wsReturn) IF lResult > 0 THEN ? STR$(lResult) & ": " & wsReturn,%MB_ICONERROR,"POST Error" ELSE ? wsReturn,,"POST OK" END IF END FUNCTION '
http://newvisionconcepts.com/subscriptions.php?param1=testvalue
$serialnumber = $_GET["param1"]; echo $serialnumber; exit;
$serialnumber = $_POST["param1"]; echo $serialnumber; exit;
<!DOCTYPE html> <html> <body> <?php $serialnumber = $_GET["param1"]; //read subscriptions.txt into a variable $content $filename = "subscriptions.txt"; $fh = fopen($filename,"r"); $content = fread($fh,filesize($filename)); fclose($fh); //test for serial number in $content $result = "InActive"; If (strpos($content,$serialnumber) !== false) {$result = "Active";} echo $result; ?> </body> </html>
<!DOCTYPE html> <html> <body> InActive </body> </html>
InActive
<?php if(isset($_GET["param1"])) { $serialnumber = $_GET["param1"]; //read subscriptions.txt into a variable $content $filename = "subscriptions.txt"; $fh = fopen($filename,"r"); $content = fread($fh,filesize($filename)); fclose($fh); //test for serial number in $content $result = "InActive"; If (strpos($content,$serialnumber) !== false) {$result = "Active";} echo $result; } ?>
0000_0000_0100_0000_E4D2_5C00_6CDF_5101 Mary Jones 0000_0000_0200_0000_E4D2_5C00_6CDF_5101 Tom Jones 0000_0000_0300_0000_E4D2_5C00_6CDF_5101 Lucas Walker 0000_0000_0400_0000_E4D2_5C00_6CDF_5101 Marvin Runner 0000_0000_0500_0000_E4D2_5C00_6CDF_5101 Gary Sitting 0000_0000_0600_0000_E4D2_5C00_6CDF_5101 Stuart Action 0000_0000_0700_0000_E4D2_5C00_6CDF_5101 Mike Working
<!DOCTYPE html> <html> <body> <?php $serialnumber = $_GET["param1"]; //read subscriptions.txt into a variable $content $filename = "subscriptions.txt"; $fh = fopen($filename,"r"); $content = fread($fh,filesize($filename)); fclose($fh); //test for serial number in $content $result = "InActive"; If (strpos($content,$serialnumber) !== false) {$result = "Active";} echo $result; ?> </body> </html>
#COMPILE EXE #DIM ALL #INCLUDE "httprequest.inc" 'José Roca includes FUNCTION PBMAIN() LOCAL wsurl,wsRequest,wsReturn AS WSTRING LOCAL lResult AS LONG wsURL = "" ' Insert the URL to your PHP or whatever script here wsRequest = "" 'Insert whatever data you want to send to the script on the server here lResult = PostReq(wsUrl,wsRequest,wsReturn) ' This is either the response or an error message IF lResult > 0 THEN ? wsReturn,%MB_ICONERROR,"POST Error" ELSE ? wsReturn,,"POST OK" END IF END FUNCTION FUNCTION PostReq(wsURL AS WSTRING, wsRequest AS WSTRING,wsReturn AS WSTRING) AS LONG DIM pHttpReq AS IWinHttpRequest pHttpReq = NEWCOM "WinHttp.WinHttpRequest.5.1" IF ISNOTHING(pHttpReq) THEN wsReturn = "WinHttpRequest.5.1 failure" :FUNCTION = 1:EXIT FUNCTION TRY pHttpReq.Open "POST", wsURL, 0 pHttpReq.SetRequestHeader "Content-Type","application/x-www-form-urlencoded" pHttpReq.Send(wsRequest) IF pHttpReq.StatusText <> "OK" THEN IF pHttpReq.StatusText = "" THEN wsReturn = "No response From Server" : FUNCTION = 2:EXIT FUNCTION ELSE wsReturn = pHttpReq.StatusText:FUNCTION = 3:EXIT FUNCTION END IF ELSE 'success wsReturn = pHttpReq.Responsetext END IF CATCH wsReturn = "COM Error"& $LF & HEX$(OBJRESULT,8) & ": " & OBJRESULT$() FUNCTION = 6 END TRY END FUNCTION '
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: