-1

I want to create a form that will send the text you typed in the text box to another server through curl. Sent text must be sent in JSON format. While creating the form in HTML is not a problem for me, it's PHP that is not so obvious to me.

My site uses Joomla version 3.6.x. Of course, after sending the text you should receive a response in JSON format, which should be displayed on the page.

Sent JSON looks like this:

{"inputtext":"Kilka godzin wcześniej doszło do rozmowy telefonicznej między prezydentem Dudą a Donaldem Trumpem, który niespodziewanie wygrał 8 listopada wybory prezydenckie w USA. Ambasador Wilczek zwrócił uwagę, że była to \"siódma rozmowa prezydenta-elekta z przywódcą kraju UE i pierwsza z przywódcą kraju z Europy Środkowo-Wschodniej, nie licząc Rosji i Ukrainy\", co jego zdaniem świadczy to o tym, że \"Trump traktuje Polskę poważnie\"."}

Response:

{"tags":[{"key":"USA","value":59},{"key":"Donald Trump","value":54},{"key":"UE","value":46},{"key":"Ukraina","value":31},{"key":"wilczek","value":19},{"key":"duda","value":17},{"key":"Rosja","value":7},{"key":"rozmowa telefoniczna","value":1},{"key":"ambasador","value":0}]}

Can someone be so kind and help me with this?

itoctopus
  • 4,133
  • 4
  • 32
  • 44
WaldeQ
  • 1
  • 1

1 Answers1

-1

You can use the Joomla ajax interface to do that. We have an exhaustive guide on how to use it here. Essentially, what you will need to do is create a "special" module and then call that module using an ajax request in order to grab the results.

Using the Joomla ajax interface is an excellent best practice that will allow your code to benefit from the security of the Joomla layer.

itoctopus
  • 4,133
  • 4
  • 32
  • 44