Ver Mensaje Individual
  #12 (permalink)  
Antiguo 01/09/2011, 08:44
w0rldart
 
Fecha de Ingreso: junio-2009
Ubicación: Madrid
Mensajes: 402
Antigüedad: 17 años, 4 meses
Puntos: 20
Respuesta: Parar al tener el resultado numero N

Por eso uso json no?
Uso solo un foreach pero no puedo hacer nada con ello.

Lo que me trae las categorias
Código PHP:

        $url 
= "http://api.com/output=json&data=getCategoriesList";
        
        
$ch = curl_init();

        
curl_setopt($ch, CURLOPT_HEADER, 0);
        
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
        
curl_setopt($ch, CURLOPT_URL, $url);

        
$data = curl_exec($ch);

        
$categories = json_decode($data);

        foreach (
$categories->categories as $category)
                {
                    
$category = $category->category;
                } 
Y lo mismo para seleccionar articulos solo que le paso una variable mas, la categoria de los articulos