Tag Archives: json

How to encode output buffers in json -php

I’m trying to encode an the result of an output buffer in json, but I’m not getting the correct result:
Il mio codice:

$n=ob_get_flush();
$arr = array('base64' => $n);
echo json_encode($arr);

The result:

xyz{"base64":null}

The hoped result:

   {"base64":xyz}

Any help would Continua a leggere

Tagged , , | Lascia un commento

Backbone.js Collection fetch with initial parameter

Is there any way to fetch a collection by giving an initial model parameter to prendere().
To clear out: I have a model Human with attributes nome (as a string) e numeri(serie)…. I would like to find all Continua a leggere

Tagged , , , | Lascia un commento

Fetch data from MYSQL and display in JSON file

I’m building and iOS application which fetches data from my MYSQL database,so to do such thing i need to use JSON(i know other methods,but i need specifically to use JSON).Il problema è, how can i fetch data from my mysqlContinua a leggere

Tagged , , , | Lascia un commento

Stop layout rendering for Ajax request with custom routing

How can I stop Layout rendering, when sending request through AJAX..
The problem I face is json data is echoed on the browser, not passed to tha call back function of jquery
ecco il mio script

jQuery.ajax({
    url: "/getPrivileges",
    type: "POST",
    

Continua a leggere

Tagged , , , , | Lascia un commento

What is the best way to put a Json string in a html tag?

What is the best way to put a json string (encoded php array) into an html tag?

<?php
$content = array(key1=>'value 1', key2=>'value 2');
?>
<span class="someclass" data="<?php echo(json_encode($content)); ?>">Stuff Here</span>

This isn’t valid because when it’s encoded it will Continua a leggere

Tagged , , , , | Lascia un commento

Cross-domain getJson request with Simple PHP proxy

Hi I’m trying to get data from an api that ONLY returns JSON rather than JSONP. Every time I try to get the data connecting as JSONP it doesn’t work because I am not expecting JSON. Così, I guess IContinua a leggere

Tagged , , , , | Lascia un commento

file php con un metodo

I need help um doing an application on android and I need to make a backend as php file which will write in another file ,
simple file with only one method get data from android application and write itContinua a leggere

Tagged , , , | Lascia un commento

Backbone.js: Weird .save() error callback

I get an error response from the .save()… funzione. The server side php returns me a text and successfully saves the url into database. When I inspect the response I can see the text returned by PHP, however I do Continua a leggere

Tagged , , , | Lascia un commento

how to post data to URL with php without curl

I have to post to a URL using PHP. right now it works but after the sending data/posting, it gives gives a json output (from the web service i’m posting to) and i need the output to be friendly.
In… Continua a leggere

Tagged , | Lascia un commento

JSON-data from iOS into PHP-script

How can I access json data within a php-script, which it received via http-post?
I’m doing the following on the iOS-side:

NSData *data = [NSJSONSerialization dataWithJSONObject:object options:0 error:NULL];

NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com/script.php"]];
[req setHTTPMethod:@"POST"];
[req setHTTPBody:data];

[NSURLConnection sendSynchronousRequest:req 

Continua a leggere

Tagged , , , | Lascia un commento
31 pagine