db fields insert + php+ curl

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
fciprian
Veteran Member
Posts: 52
Joined: 2020-04-20 10:51

db fields insert + php+ curl

Post by fciprian » 2022-03-22 07:52

Hello!
First of all i want to say "thank you" to all appgini contributors!

I need some help on a situation:
this is a part of my textsend.php that it is integrated to appgini app:

.....

$text = $db['Text'];
$telefon = $db['Numar_telefon'];

$curl = curl_init();

$details = '{
"phone": "+40740123456",
"shortTextMessage": "Test msg"
}';

.....

So like this works like a charm. But i need to get info from the appgini db and i tried like this but no luck:) :

$details = '{
"phone": $telefon,
"shortTextMessage": $text
}’;

I also tested and the variables $text and $telefon works corectly (in the page i have the code to extract all data corect).
The problem is that i can not integrate them on $details .

Thank you verry much for your time!! Hope you can help me

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1814
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: db fields insert + php+ curl

Post by jsetzer » 2022-03-22 10:22

Code

Code: Select all

<?php
// ...
$text = $db['Text'];
$telefon = $db['Numar_telefon'];

$data = [
    "phone" => $telefon,
    "shortTextMessage" => $text
];

$details = json_encode($data);
// ...
Result

Given the following test-data...

Code: Select all

$text = "Hallo";
$telefon = "+491234567890";
... this will be the content of $details variable:

Code: Select all

{"phone":"+491234567890","shortTextMessage":"Hallo"}
PS: Please put code fragments in [ code ] YOUR CODE HERE [ /code ], see here: app.php/help/bbcode#f2r1
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

fciprian
Veteran Member
Posts: 52
Joined: 2020-04-20 10:51

Re: db fields insert + php+ curl

Post by fciprian » 2022-03-22 11:50

Works verry good.

Thank you!!! thank you! Thank you!!!!!!!

Post Reply