Note that there are some explanatory texts on larger screens.

plurals
  1. POpost data with file_get_content
    primarykey
    data
    text
    <p>I have done some research regarding on how to use <code>file_get_content</code> with post. And I have also read <a href="https://stackoverflow.com/questions/2445276/how-to-post-data-in-php-using-file-get-contents">this one</a> which is I honestly don't understand since I am not that familiar with PHP. Below is my php code in getting my json and used it for my ajax request, using methog <code>GET</code>.:</p> <pre><code>&lt;?php echo(file_get_contents("http://localhost:8001/" . $_GET["path"] . "?json=" . urlencode($_GET["json"]))); ?&gt; </code></pre> <p>Now, I am using method <code>POST</code> and I dont know how to modify my php code to post my data from my javascript. Below is my <code>data</code> which I wanted to post in my url request (that is also what I used as <code>json</code> in method <code>GET</code>):</p> <pre><code>{"SessionID":"9SQLF17XcFu0MTdj5n", "operation":"add", "transaction_date":"2011-7-28T00:00:00", "supplier_id":"10000000108", "wood_specie_id":"1", "lines": [{"...":"...","..":"..."},{"...":"...","..":"..."}], "scaled_by":"SCALED BY", "tallied_by":"TALLIED BY", "checked_by":"CHECKED BY", "total_bdft":"23.33", "final":"N"} </code></pre> <p>I just need to change this code</p> <pre><code>echo(file_get_contents("http://localhost:8001/" . $_GET["path"] . "?json=" . urlencode($_GET["json"]))); </code></pre> <p>with <code>POST</code> to send my post my data.</p> <p><b>EDIT:</b> I need to produce a request like this:</p> <pre><code>http://localhost/jQueryStudy/RamagalHTML/processjson.php?path=getData/supplier?​json={"SessionID":"KozebJ4SFqdqsJtRpG6t1o3uQxgoeLjT"%2C"dataType":"data"} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload