---
title: "Php methods in Json"  
description: "Php methods in Json"  
author: "Anonymous User"  
published: 2018-07-03  
updated: 2018-07-03  
canonical: https://www.mindstick.com/forum/34572/php-methods-in-json  
category: "json"  
tags: ["json"]  
reading_time: 1 minute  

---

# Php methods in Json

[explain](https://www.mindstick.com/forum/157854/what-is-system-debugging-explain-some-system-debugging-tools-used-in-modern-computer-systems) [post](https://www.mindstick.com/articles/12829/aspects-that-make-australia-post-shipping-extension-a-useful-tool) [method](https://www.mindstick.com/forum/166/webservice-method) in [PHP](https://www.mindstick.com/articles/12149/php-constant-and-php-variables) [Json](https://www.mindstick.com/forum/34446/convert-json-string-to-object) ?

## Replies

### Reply by Prakash nidhi Verma

JSON PHP:

Read data from a web server, and display the data in a web page is a common use of JSON.

```
<?php $myObj->name = "Prakash";
$myObj->age = 19;
$myObj->city = "Allahabad";
$myJSON = json_encode($myObj);
echo $myJSON;
?>
```

PHP Method = POST :

When you sending data to the server,it is often best to use the HTTP POST method.

The data sent to the server must now be an argument to the .send() method:

Example:

```
obj = { "table":"customers", "limit":10 }; dbParam = JSON.stringify(obj);
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        myObj = JSON.parse(this.responseText);
        for (x in myObj) {
            txt += myObj[x].name + "<br>";
        }
        document.getElementById("Mindstick").innerHTML = txt;
    }
};
xmlhttp.open("POST", "json_demo_db_post.php", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send("x=" + dbParam);
```


---

Original Source: https://www.mindstick.com/forum/34572/php-methods-in-json

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
