Android 如何使用RESTAPI检索电子商务产品数据?

Android 如何使用RESTAPI检索电子商务产品数据?,android,api,woocommerce,Android,Api,Woocommerce,我正在使用api php获取woocommerce产品数据,但工作不正常。 请查找下面的代码。 任何帮助都将不胜感激 $conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); //Checking if any error occured while connecting if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connec

我正在使用api php获取woocommerce产品数据,但工作不正常。
请查找下面的代码。
任何帮助都将不胜感激

$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);

//Checking if any error occured while connecting
if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    die();
}

//creating a query
$stmt = $conn->prepare("SELECT p.ID,p.post_title,p.post_status,p.post_name,pp.min_price,pp.max_price,
pi.meta_value FROM `wp_posts` p INNER JOIN `wp_wc_product_meta_lookup` pp ON pp.product_id = p.ID  
INNER JOIN  `wp_postmeta` pi ON pi.post_id=p.ID where p.post_status='publish' and pi.meta_key ='_wp_attached_file'
 and `p.post_type`='product'GROUP BY p.ID;");

//executing the query 
$stmt->execute();

//binding results to the query 
$stmt->bind_result($post_id,$post_title, $post_status, $post_name,$min_price, $max_price , $meta_value);

$courses = array(); 

//traversing through all the result 
while($stmt->fetch()){
    $temp = array();
    $temp['post_id'] = $post_id; 
    $temp['post_title'] = $post_title; 
    $temp['post_status'] = $post_status; 
    $temp['post_name'] = $post_name; 
    $temp['min_price'] = $min_price; 
    $temp['max_price'] = $max_price; 
    $temp['meta_value'] = $meta_value; 
    array_push($courses, $temp);
}
//echo count($courses);
//displaying the result in json format 
echo json_encode($courses);

大家好,欢迎来到StackOverflow!有什么问题?安卓端还是服务器端?我需要一个从Woo commerce world press获取数据到安卓应用程序的解决方案。我已经搜索了很多次,但没有找到解决方案。有人帮我吗?你好,欢迎来到StackOverflow!有什么问题?安卓端还是服务器端?我需要一个解决方案,将来自Woo commerce world press的数据提取到安卓应用程序中。我已经搜索了很多次,但没有找到任何解决方案。有人帮我吗