PHP: JSON Api Tenor

how can i get all url-s from (results->media->nanomp4->url)

if($json = cURLGetContents("")) {
    $obj = json_decode($json);
    echo $obj->results->{"media"}->{"nanomp4"}->{"url"};

Function cURLGetContents($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $data = curl_exec($ch);
    return $data;

Source: stackoverflow-php

Iterating through a javascript object to get key-value pairs

Here’s my code:

obj = {"TIME":123,"DATE":456}


for (var key in obj) {

It prints as the following:


Why does console.log(obj.key) print as undefined?

I want my code to print out the following, using obj.key to print out the value for each key:


How do I do so?

Source: stackoverflow-javascript

how to replace fetched values in a array pattern?

I need to fetch values for jquery calender on a website. example of calender looks like that:

$array = array(
        date => '27/7/2017',
        title => 'Getting',
        link => 'http://someurl',
        color => 'red'
        date => '27/7/2017',
        title => 'Getting',
        link => 'http://someurl',
        color => 'red'

I created some function

$basket = array(
        array('12/7/2017','Getting C','red','index.php')

to become right array, but I do not know how to replce values in the necessary fields values and print it out for to

json_encode($basket, JSON_UNESCAPED_UNICODE);

please if someone can help me in this case

Source: stackoverflow-php

set a column property as the first element of a nested array in ngx-data-table

 <ngx-datatable-column name="Gender" [width]="80" prop="resource.gender"></ngx-datatable-column>
 <ngx-datatable-column name="First Name" [width]="80" prop="[0].text"></ngx-datatable-column>

The last column does not work in my example above, because i cannot specify the first element of a nested array in my json. Without flattening my json is there another trick to do this?

ideally if i could say prop = name.first.text it would work but no such first method exists.

Source: stackoverflow-javascript

Passing in a Array as Metadata for Values in EditableGrid

I am trying to create a drop down menu in this library(EditableGrids), in the example they have all of the menu options hardcoded in, I tried to use a array as the filter which gives me the correct amount of choices but all of the choices are listed as undefined but if I reference the values by themselves they output the correct data.

JS Function which includes values

EditableGrid.prototype.onloadHTML = function (tableId) {
// metadata are built in Javascript: we give for each column a name and a 

    metadata: [
            name: "name",
            datatype: "html",
            editable: true
            name: "continent",
            datatype: "string",
            editable: true,
            values: {

PHP part of function passing array

$response1 = sqlsrv_query($conn, "SELECT DISTINCT Contacts.[ID],Contacts.[First Name], Contacts.[Last Name] 
FROM [TechInv].[dbo].[Assets] INNER JOIN  Contacts ON Contacts.[ID]=Assets.[Owner]");
$arr = array();
               while ($row1 = sqlsrv_fetch_array($response1)){
                   $arr[$i]= $row1['ID'];
                   $arr[$i+1]= $row1['First Name'] . " " . $row1['Last Name'];

    var arr = ;

Here is my code for my array and putting in into the value which I believe is what affects the drop down menu option. I was wanting to make sure my format wasn’t off for inputting the array as the option, or if this is not possible. Alternately if there is another way to easily accomplish this I would love to know it.

Source: stackoverflow-php

getting json values into php variable issue

i try to use some sms api and i have to get message-id. First of all here is the my api code.

$url = '' . http_build_query(
      'api_key' =>  'xxx',
      'api_secret' => 'xxx',
      'to' => 'xxx',
      'from' => 'xxx',
      'text' => 'xxx'
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);

When i use this code it’s working for sending sms and return response. And here is the json response.

{ "message-count": "1", "messages": [{ "to": "905075214049", "message-id": "0C000000440A086C", "status": "0", "remaining-balance": "1.52250000", "message-price": "0.01910000", "network": "28603" }] }

And i use the print_r function to see the structrue of json data. And here it’s.

stdClass Object
    [message-count] => 1
    [messages] => Array
            [0] => stdClass Object
                    [to] => xxx
                    [message-id] => 0C000000440A086C
                    [status] => 0
                    [remaining-balance] => 1.52250000
                    [message-price] => 0.01910000
                    [network] => 28603



I use this code to get “message-id” into my php value.

$json_decode = json_decode($response);

My issue is; if i try to get network section from this json it works. But if i try to get “message-id” section it returns only 0 on the screen. I really don’t know how can i get full message-id. Please help.

Source: stackoverflow-php

Node.js app reading chached json value

I have recently started making a node.js app and have gotten to a point at which I need to read a value of a JSON that has just been updated, but not successfully, I have tried using the ‘sleep’ module to stop threads for a small delay but still no luck.

I haven’t been using node.js for very long either, for only about 5 months.

-Thank you in advance

Source: stackoverflow-javascript

request to Random Word SetGetGo API

I’m trying to get words from this website:
How do I create a request to this API? Is there something that i’m missing?

var bot = new Discord.Client(); //new instance of discord client

bot.on("ready", () => {

var prefix = "!~"
bot.on("message", message => { //when we recieve a message, we'll run this
    if( === bot.user) return;
    if(message.content.startsWith(prefix + "start")){;

function RandomWord() {
var requestStr = "";

    type: "GET",
    url: requestStr,
    dataType: "jsonp",
    jsonpCallback: 'RandomWordComplete'

function RandomWordComplete(data) {

Source: stackoverflow-javascript

Write json file to Firebase with Node.js?

I have a third party API that I need to call every 5 seconds. I get JSON as response, and I’d like to write the JSON content to a Firebase node using Node.js. Based on Firebase examples I could import data with this code:

var usersRef = ref.child("users");
  alanisawesome: {
    date_of_birth: "June 23, 1912",
    full_name: "Alan Turing"
  gracehop: {
    date_of_birth: "December 9, 1906",
    full_name: "Grace Hopper"

Curl examples worked too. But what I really wanted to do is to import a third party API response directly to my Firebase database using the API endpoint. How can i do it with Node.js?

Source: stackoverflow-javascript