How can I get data from php page (without json)?

pass php variable to javascript file
pass php variable to javascript function
php json stringify
how to pass data from php to javascript using ajax
pass data from php to jquery
php json encode
pass data from php to react
php json_encode utf8

I have this site ( and I want to get number from it (there's no JSON) to my android studio application using retrofit 2 and show this number in the text view. What converter factory should I use instead GsonConverterFactory? Or how can I get number from this page to my text view?

I tried to use GsonConverterFactory.create() for this, but it didn't make a response and showed a log from onFailure method

This is MainActivity.class (with useless GsonConverterFactory):

public class MainActivity extends AppCompatActivity {

    TextView tv;
    Button btn;

    protected void onCreate(Bundle savedInstanceState) {

        tv = findViewById(;
        btn = findViewById(;

        btn.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {

                Retrofit retrofit = new Retrofit.Builder()

                DolgAPI apiService = retrofit.create(DolgAPI.class);

                Call<String> call = apiService.getDolg();

                call.enqueue(new Callback<String>() {
                    public void onResponse(Call<String> call, Response<String> response) {
                        Log.d("MyLog", "Got it!");

                    public void onFailure(Call<String> call, Throwable t) {
                        Log.d("MyLog", "Error");


This is Retrofit2 response API:

public interface DolgAPI {

    String HOST = "";

    Call<String> getDolg();


I used WebView to dispaly value from that site

It contains JavaScript so I used next lines to allow executing web scripts in application:

WebSettings webSettings = myWebView.getSettings();

Submitting Forms Without Reloading The Page: AJAX , There are a lot of “without-page-refresh” solutions out there, but here's one you A behind-the-scenes request is sent to the server, and returning data to your form​. However, it's easier to send them in JSON, which JavaScript likes more. The WordPress admin-ajax.php file requires the action property. The jQuery ajax is very useful when you want to post or get data from PHP script without page refresh. Generally, you return the string to Ajax call for updating a part of the web page. But sometimes requires getting the object or array data from PHP file for showing values in the different area.

First of all looks like the website if not functional as it not loading. But if assume it is working and you don't have there any GET/ endpoint, you will receive back whole HTML document, and you need to parse it via html tags to fetch the required text. Mashups, This XML data can come from anywhere, such as a PHP script or web service, routinely by your web page, without the need for a form submit or page reload. I'm trying to get data from the following JSON file using PHP. I specifically want "temperatureMin" and "temperatureMax". It's probably really simple, but I have no idea how to do this. I'm stuck on what to do after file_get_contents("file.json"). Some help would be greatly appreciated!

You should use ResponseBody

getDolg() should return Call<ResponseBody>

Then you have to parse html. Loan returns in this format

<span id="debt-clock">$21,954,170,905,365.84</span>

You can parse html using regex.

PHP JSON complete tutorial (with examples), JSON is a data container used to send, receive and store variables. <Contact> <Site></Site> <Phone>123456789</Phone> By default, without this option, if you encode a numeric array you get a JSON array: /* A PHP​  The value of any JSON key can be a string, Boolean, number, null, array, or object. Comments are not allowed in JSON. Although JSON resembles an object or an array, JSON is a string. A serialized string, which means it can later be parsed and decoded into data types. Using data from JSON with PHP

json_encode - Manual, The behaviour of these constants is described on the JSON constants page. the attributes and no error or exception will issue - the original data will simply be​  The next step is to fetch the decoded values and store it in variables of PHP. This can be done by fetching one-by-one and storing it in different variables. Step 5: Inserting the fetched JSON Data to into database. Finally, the fetched JSON data is inserted into the database using MySQL query.

Store HTML Table Values in a Javascript Array and Send to a PHP , The code examples on this page are functional code snippets and can How to access a JSON encoded Javascript array in PHP In this example, the value of each table cell is appended to the tr){ TableData = TableData + $(tr).find('td:eq(​0)').text() + ' ' // Task No. How to send it to database(Mysql)?. The JSON data format is mostly used in web services to interchange data through API. When you working with web services and APIs, sending JSON data via POST request is the most required functionality. PHP cURL makes it easy to POST JSON data to URL. In this tutorial, we will show you how to POST JSON data using PHP cURL and get JSON data in PHP.

How to receive JSON POST with PHP, Later, we can use the json_decode() function to decode the JSON string. Handling JSON POST request: // Takes raw data from the request $json = file_get_contents('php://input'); // Converts it into a echo $data ->site; ? What is POST(Power-On-Self-Test)? · HTTP GET and POST Methods in PHP · jQuery No votes yet. Note that json_decode converts the json string to an object -- and by specifying the second parameter as true, it will be an (associative) array. As such, you can then access the data contained within the array like you would a normal array as specified by Ignacio and Jleagle. You can either iterate over the data or display it one by one.