B4J Question [SOLVED} OPENURLINBROWSER cut the URL

Schakalaka

Active Member
Licensed User
I?m going to use wx.netword payment apy.
I have create some code that return a json url for open it directly on pc browser for make the payment.
The problem is that the url
B4X:
https://wx.network/#send/WAVES?recipient=3P6WaYhijLuFRsWFmQBGJmRX1ccJi5BAPcU&amount=0.01&attachment=SomeString&referrer=https://example.com&strict
when open from the code
B4X:
OpenURLInBrowser("https://wx.network/#send/WAVES?recipient=3P6WaYhijLuFRsWFmQBGJmRX1ccJi5BAPcU&amount=0.01&attachment=SomeString&referrer=https://example.com&strict")


B4X:
Sub OpenURLInBrowser(URL As String)
    Dim shell As Shell
    shell.Initialize("shell", "cmd", Array As String(" /c start " & URL)) ' Modifica "cmd" con il comando del tuo sistema operativo (e.g., "xdg-open" su Linux)
    shell.WorkingDirectory = File.DirApp
    shell.Run(-1) ' Esegui il comando
End Sub



open only the forst part of the url
B4X:
https://wx.network/#send/WAVES?recipient=3P6WaYhijLuFRsWFmQBGJmRX1ccJi5BAPcU
without the amount and other paramethers.


how can i solve this?

php code for generate the final url:

B4X:
case "creaStakeTrx":
    $assetId = "E3V7G5veDsXvg6aJ91kfDV8dXXApTfvhiep1TRK7HmuZ"; // ID del token DUMCOIN
    $recipient = "3P6WaYhijLuFRsWFmQBGJmRX1ccJi5BAPcU"; //INDIRIZZO DESTINATARIO
    $amount = $_GET["amount"];
    $attachment = $_GET["attachment"];
    $referrer = "https://test.clickandclaim.me/miefinanze/reffer.php";
   // $strict = isset($_GET["strict"]) && $_GET["strict"] === "true";

    // Crea l'URL di pagamento
$paymentURL = "https://wx.network/#send/" . urlencode($assetId) . "?recipient=" . urlencode($recipient) . "&amount=" . urlencode($amount);
$paymentURL .= "&attachment=" . urlencode($attachment) . "&referrer=" . urlencode($referrer) . "&strict=true";


    // Effettua il pagamento reindirizzando l'utente
     // Costruisci un array con l'URL
    $responseArray = array("paymentURL" => $paymentURL);

    // Invia la risposta JSON contenente l'URL
    header("Content-Type: application/json");
    echo json_encode($responseArray);
 
    break;

for call it paste on browser this url:
B4X:
https://test.clickandclaim.me/miefinanze/myapi.php?action=creaStakeTrx&amount=50&attachment=Pack1


API documentation:
B4X:
https://docs.wx.network/en/guide/client-api/payment-api



the next step will be save the trxid on mysqbl database..
 

Daestrum

Expert
Licensed User
Longtime User
It could be the # in the URL - try changing it to %23 (# is not valid in a URL as far as I am aware)
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
it's the "&" charcacter. it has to be escaped: URL.Replace("&", "^&" )

from the internet"
The ampersand (&), pipe (|), and parentheses ( ) are special characters that must be preceded by the escape character (^) or quotation marks when you pass them as arguments.
 
Upvote 0
Top