So i am stuck with one problem i have $amount wich is $_post["amount"] however the rpc requires that numeric values has to be inserted without quotes so when i type the amount manually in the php pages it works and generates this request:
"{"method":"sendTransaction","params":{"anonymity":0,"fee":1000000,"addresses":["S6EHUg5k8K2br3mAVnd13AGGjYqXw1rCzjGn6z7Wnf7eaAE8nZtwZD1dcc2L3h137P1NTKxh9HM6y5AfBHtwnGjp21jW52w1q"],"transfers":[{ "amount":70000,"address":"S6F8bN49qSUK2SunXpB8rnEp6LdCXoS2f6ZSfC8pxmhYjhqqkNj6o4jdcc2L3h137P1NTKxh9HM6y5AfBHtwnGjp21jVCmZDm"}]}}"
But when i use the value from the form it generates this request
"{"method":"sendTransaction","params":{"anonymity":0,"fee":1000000,"addresses":["S6EHUg5k8K2br3mAVnd13AGGjYqXw1rCzjGn6z7Wnf7eaAE8nZtwZD1dcc2L3h137P1NTKxh9HM6y5AfBHtwnGjp21jW52w1q"],"transfers":[{ "amount":"70000","address":"S6F8bN49qSUK2SunXpB8rnEp6LdCXoS2f6ZSfC8pxmhYjhqqkNj6o4jdcc2L3h137P1NTKxh9HM6y5AfBHtwnGjp21jVCmZDm"}]}}"
here is the code:
PHP Code
<?php $da = array("method" => "sendTransaction", "params" => array("anonymity" => 0 ,"fee" => 1000000, "addresses" => array($address1), "transfers" => array(array("amount" => $amount ,"address" => $receive))));
=============================================
Nothing yet
=============================================
DO NOT DEAL WITH THIS MEMBER
(Jan 30, 2018 03:15 AM)deadsh0t Wrote: So i am stuck with one problem i have $amount wich is $_post["amount"] however the rpc requires that numeric values has to be inserted without quotes so when i type the amount manually in the php pages it works and generates this request:
"{"method":"sendTransaction","params":{"anonymity":0,"fee":1000000,"addresses":["S6EHUg5k8K2br3mAVnd13AGGjYqXw1rCzjGn6z7Wnf7eaAE8nZtwZD1dcc2L3h137P1NTKxh9HM6y5AfBHtwnGjp21jW52w1q"],"transfers":[{"amount":70000,"address":"S6F8bN49qSUK2SunXpB8rnEp6LdCXoS2f6ZSfC8pxmhYjhqqkNj6o4jdcc2L3h137P1NTKxh9HM6y5AfBHtwnGjp21jVCmZDm"}]}}"
But when i use the value from the form it generates this request
"{"method":"sendTransaction","params":{"anonymity":0,"fee":1000000,"addresses":["S6EHUg5k8K2br3mAVnd13AGGjYqXw1rCzjGn6z7Wnf7eaAE8nZtwZD1dcc2L3h137P1NTKxh9HM6y5AfBHtwnGjp21jW52w1q"],"transfers":[{"amount":"70000","address":"S6F8bN49qSUK2SunXpB8rnEp6LdCXoS2f6ZSfC8pxmhYjhqqkNj6o4jdcc2L3h137P1NTKxh9HM6y5AfBHtwnGjp21jVCmZDm"}]}}"
here is the code:
PHP Code
<?php $da = array("method" => "sendTransaction", "params" => array("anonymity" => 0 ,"fee" => 1000000, "addresses" => array($address1), "transfers" => array(array("amount" => $amount ,"address" => $receive))));
I am not sure if this will work, but you can try using function stripslashes()
PHP Code
<?php $da = array("method" => "sendTransaction", "params" => array("anonymity" => 0 ,"fee" => 1000000, "addresses" => array($address1), "transfers" => array(array("amount" => stripslashes($amount), "address" => $receive))));
(Jan 30, 2018 06:57 AM)Devsoft™ Wrote: I am not sure if this will work, but you can try using function stripslashes()
PHP Code
<?php $da = array("method" => "sendTransaction", "params" => array("anonymity" => 0 ,"fee" => 1000000, "addresses" => array($address1), "transfers" => array(array("amount" => stripslashes($amount), "address" => $receive))));
thanks however it doesnt seem to work , but i just fixed it by adding JSON_NUMERIC_CHECK to de encoding part
=============================================
Nothing yet
=============================================
Have you tried using this, real_escape_string.
PHP Code
<?php $s = "abcdefg"; $n1 = "100.99"; $n2 = 100.325;
$x = array("S" => $s, "n1" => $n1, "n2" => $n2);
echo json_encode($x);
echo "<br>";
$x = array("S" => $s, "n1" => (float) $n1, "n2" => $n2); echo json_encode($x);
returns
{"S":"abcdefg","n1":"100.99","n2":100.325}
{"S":"abcdefg","n1":100.99,"n2":100.325}
You need to type cast/juggle -> http://php.net/manual/en/language.types....ggling.php
Try using intval, seems like $amount is a string.
Replace $amount with intval($amount).
(Jan 30, 2018 09:39 AM)Charger Wrote: PHP Code
<?php $s = "abcdefg"; $n1 = "100.99"; $n2 = 100.325;
$x = array("S" => $s, "n1" => $n1, "n2" => $n2);
echo json_encode($x);
echo "<br>";
$x = array("S" => $s, "n1" => (float) $n1, "n2" => $n2); echo json_encode($x);
returns
{"S":"abcdefg","n1":"100.99","n2":100.325}
{"S":"abcdefg","n1":100.99,"n2":100.325}
You need to type cast/juggle -> http://php.net/manual/en/language.types....ggling.php
yes this works also i will keep this in mind thanks for now im using JSON_NUMERIC_CHECK
=============================================
Nothing yet
=============================================
(Jan 31, 2018 02:43 AM)deadsh0t Wrote: yes this works also i will keep this in mind thanks for now im using JSON_NUMERIC_CHECK
Glad that fixed it. Just keep in mind that JSON_NUMERIC_CHECK is kind of a half-assed constant in PHP.
http://www.garageenbois.fr/posts/why-jso...-good-idea
|