Forum > Networking and Web Programming

Elavon my IP returning redirect

(1/1)

RedOctober:
Platform:  Lazarus 2.0.10   FPC 3.2.0   IndyHTTP   Windows Server 2016
Goal: To allow my clients to pay for my services on line.  I will be using Elavon's Hosted Page model.
Current status: I am at the very beginning of this process.  I am trying to get WhiteListed
Others involved:  I am in contact with the Elavon developer support team, who are not familiar with Lazarus, IndyHTTP, etc.
I am following the instructions given in my introductory email, which are as follows:


https://www.convergepay.com/hosted-payments/myip


--- Code: PHP  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---<?php  $ch = curl_init("https://www.convergepay.com/hosted-payments/myip");  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  curl_setopt($ch, CURLOPT_HEADER, 0);  $data = curl_exec($ch);  echo $data;  exit;?>
Here is the code I used to send the above:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- procedure TfrmMain.SendElvURL;var  htp: TIdHTTP;  ReqJson: TStringStream;  JSON: TJSONStringType;  s, url: String; begin  url := 'https://urldefense.proofpoint.com/v2/url?u=https-3A__www.convergepay.com_hosted-2Dpayments_myip&d='; //  (last part removed, in case it is a private ID for me only)    s :=    '<?php' +      '$ch = curl_init("https://www.convergepay.com/hosted-payments/myip");' +      'curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);' +      'curl_setopt($ch, CURLOPT_HEADER, 0);' +      '$data = curl_exec($ch);' +      'echo $data;' +      'exit;' +    '?>';   ReqJson := TStringStream.Create(s);   try     htp := htpElv;     htp.Request.Accept := 'application/json';    htp.Request.ContentType := 'application/json';    htp.Request.Username := '';     htp.Request.Password := '';     htp.Request.BasicAuthentication := False;     htp.Request.CustomHeaders.Clear;    htp.Request.CustomHeaders.FoldLines := False;     htp.Get(url, ReqJson);   finally      ReqJson.Free;     if htp.Connected then      htp.Request.Connection := 'close';   end; end;  
The result of executing this procedure is that my app stops, and displays a modal error message: 


[Window Title]
cwp

[Content]
HTTP/1.1 302 Found.

Press OK to ignore and risk data corruption.
Press Abort to kill the program.

[OK] [Abort]

So my question is...

1) Am I setting all the properties correctly to perform the "GET" as requested by Elavon?
2) Is this expected behavior of the IdHTTP component?
3) Is there a better, proper way for me to handle a 302 message, instead of it displaying an error and stopping my app, so I have to manually click "OK" to get it to start up again?

Thanks in advance for any help you can provide.

[Edited to add code tags]

PierceNg:

--- Quote from: RedOctober on May 14, 2021, 05:22:21 pm ---https://www.convergepay.com/hosted-payments/myip

--- End quote ---

This link just tells you what your public IP is, as seen by the website.

Your Pascal code is sending a PHP code snippet to what appears to be proofpoint.com's API, telling said API that the PHP code is in JSON format when it is not. The Pascal code is most likely not doing whatever you want done.

Navigation

[0] Message Index

Go to full version