snickwhy / poster-extension

Automatically exported from code.google.com/p/poster-extension
0 stars 0 forks source link

can't send a function to get it's return value at the response #111

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.I test a php webservice I did
2.I send a function to a url 
3.I got no data - blank response 

What is the expected output? What do you see instead?
json data

What version of the product are you using? On what operating system?
windows 7

Please provide any additional information below.
 0 down vote favorite

I made a simple API to get the data from the database to be viewd at android app

I have a Problem testing my php functions

example of the functions:-

<?php
include 'json_config.php';
function get_city(){
mysql_query("SET NAMES utf8;");
mysql_query("SET CHARACTER_SET utf8;");
$return=array();
//$country_name=$_POST['country_name'];

// get all products from products table
$result = mysql_query("SELECT *FROM city") or die(mysql_error());

// check for empty result
if (mysql_num_rows($result) > 0) {
    // looping through all results
    // products node
    $response["city"] = array();

    while ($row = mysql_fetch_array($result)) {
        // temp user array
        // Full texts   id  dead_name   masged_name     gender  salah       notes   date    city_name   hour    min 
        $region_subscribt = array();
        $region_subscribt["id"] = $row["id"];
        $region_subscribt["city_name"] = $row["city_name"];
        $region_subscribt["region_name"] = $row["notes"];
        $region_subscribt["notes"] = $row["country_name"];
    // push single product into final response array
    array_push($response["city"], $region_subscribt);
}

// echoing JSON response
echo json_encode($response,JSON_UNESCAPED_UNICODE);
} else {
// no products found
$response["fail"] = 0;

// echo no users JSON
echo json_encode($response,JSON_UNESCAPED_UNICODE);
}
}//end of the function

// get_city();
?>

when I using poster extention with firefox and put at the content , I got no 
data when I put at the content

 getcity();

but when I call the function inside the php file I got the data correctly !

How to pass the values at the httprequest to use the returned json at another 
app !
I'd be glad if I got some help !

Original issue reported on code.google.com by mustafa....@mufix.org on 2 Feb 2014 at 11:02