json - Simplify php curl code -


i trying json url. code working think better. (remove json_decode or json_encode). right have: (edit: still want use curl)

<?php  $curl = curl_init('url');   curl_setopt($curl, curlopt_url, 'url');  curl_setopt($curl, curlopt_returntransfer, true);   $result = curl_exec($curl);   curl_close($curl);   $data = json_decode($result, true);   echo json_encode($data["name"]);   ?> 

you can try this:

$data = json_decode(file_get_contents('php://input')); print_r($data); 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -