<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hugo Almada</title>
    <description>The latest articles on DEV Community by Hugo Almada (@hugo_almada_5307).</description>
    <link>https://dev.to/hugo_almada_5307</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2419925%2F9923f05a-362d-435d-8340-ebc797e2a20f.jpg</url>
      <title>DEV Community: Hugo Almada</title>
      <link>https://dev.to/hugo_almada_5307</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hugo_almada_5307"/>
    <language>en</language>
    <item>
      <title>Código php que lee json del sitio de telebingo triple senete y lo formatea</title>
      <dc:creator>Hugo Almada</dc:creator>
      <pubDate>Tue, 12 Nov 2024 19:06:03 +0000</pubDate>
      <link>https://dev.to/hugo_almada_5307/codigo-php-que-lee-json-del-sitio-de-telebingo-triple-senete-y-lo-formatea-3n4e</link>
      <guid>https://dev.to/hugo_almada_5307/codigo-php-que-lee-json-del-sitio-de-telebingo-triple-senete-y-lo-formatea-3n4e</guid>
      <description>&lt;p&gt;Código php que lee json del sitio de telebingo triple senete y lo formatea para imprimirlo en cualquier web de sorteos&lt;/p&gt;

&lt;p&gt;Para crear un código PHP que lea el JSON proporcionado y lo imprima en un HTML conforme al formato que mencionas, primero debemos descomponer el JSON, procesar los datos y, finalmente, generarlo en un formato HTML adecuado. A continuación, te muestro un ejemplo de cómo puedes hacerlo.&lt;/p&gt;

&lt;p&gt;Puedes ver en funcionamiento el código en la página de &lt;a href="https://ipparaguay.com.py/telebingo-triple-talisman/" rel="noopener noreferrer"&gt;telebingo triple&lt;/a&gt; donde se consulta el &lt;a href="https://ipparaguay.com.py/telebingo-triple-resultado-por-numero-de-carton/" rel="noopener noreferrer"&gt;sorteo de telebingo triple por número de cartón&lt;/a&gt; y también desde la página de &lt;a href="https://ipparaguay.com.py/senete/" rel="noopener noreferrer"&gt;seneté&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paso 1: Leer y decodificar el JSON&lt;br&gt;
Primero, leeremos el JSON y lo decodificaremos. Luego, extraeremos la información necesaria para mostrarla en la página HTML.&lt;/p&gt;

&lt;p&gt;`&lt;br&gt;
&amp;lt;?php&lt;br&gt;
$jsonData = "{&lt;br&gt;
    "datos": {&lt;br&gt;
        "fecha": "2024-11-03 00:00:00.0",&lt;br&gt;
        "json": "[{"nombreJugada":"GRANDIO2OS","sorteoJugadaId":"2582","cantidadGanadores":20,"identificador":"1378","bolillas":"02,03,05,06,09,10,12,16,17,21,22,25","azar":false,"premios":[{"premio":"POZO","nroGanadores":"0","aciertos":"12"},{"premio":"GS. 2.000.000","nroGanadores":"20","aciertos":"11"}]},{"nombreJugada":"PODEROSO","sorteoJugadaId":"2581","cantidadGanadores":9312,"identificador":"1378","bolillas":"01,04,06,09,12,13,14,15,19,21,22,25","azar":false,"premios":[{"premio":"Gs. 2.300.000.000","nroGanadores":"0","aciertos":"12"},{"premio":"Gs. 2.000.000","nroGanadores":"4","aciertos":"11"},{"premio":"Gs. 50.000","nroGanadores":"195","aciertos":"10"},{"premio":"Gs. 10.000","nroGanadores":"2360","aciertos":"9"},{"premio":"Gs. 10.000","nroGanadores":"5964","aciertos":"3"},{"premio":"Gs. 10.000","nroGanadores":"751","aciertos":"2"},{"premio":"Gs. 10.000","nroGanadores":"38","aciertos":"1"},{"premio":"Gs. 2.000.000","nroGanadores":"0","aciertos":"0"}]},{"nombreJugada":"DOBLE CHANCE","sorteoJugadaId":"2580","cantidadGanadores":7311,"identificador":"1378","bolillas":"02,03,06,07,08,09,10,11,12,13,15,16,17,19,24","azar":false,"premios":[{"premio":"POZO","nroGanadores":"0","aciertos":"15"},{"premio":"Gs. 2.000.000","nroGanadores":"22","aciertos":"14"},{"premio":"Gs. 50.000","nroGanadores":"560","aciertos":"13"},{"premio":"Gs. 10.000","nroGanadores":"6729","aciertos":"12"}]},{"cantidadGanadores":112,"azar":true,"premios":[{"premio":"Gs. 500.000","cartones":"405931, 407425, 407483, 411464, 418426, 421362, 425586, 427759, 444899, 451184, 452540, 477827, 480302, 485164, 490563, 498225, 504490, 507129, 509142, 510240, 510311, 517545, 517605, 518613, 525792, 529142, 534636, 545077, 552355, 555176, 556951, 560836, 560962, 564833, 567956, 575681, 576714, 586287, 589607, 592422, 594188, 595328, 599717, 605993, 613501, 622734, 629121, 631882, 633353, 639357"},{"premio":"Gs. 500.000","cartones":"406842, 409941, 411357, 414963, 419667, 423968, 434055, 437766, 443013, 446521, 447928, 450752, 452209, 453226, 462838, 463892, 473985, 477497, 483080, 487045, 491689, 494728, 498525, 500689, 504067, 510558, 519067, 524212, 528586, 539488, 560713, 561981, 562421, 566093, 566891, 578405, 592665, 596124, 598131, 598461, 600622, "601236, 603595, 608801, 611915, 623820, 627470, 628212, 634710, 637729"},{"premio":"UNA BICICLETA + CASCO + BOTELLA TÉRMICA","cartones":"409064, 424219, 479655, 480388, 481137, 512700, 589198, 593049, 617528, 633767"},{"premio":"UNA NISSAN KICKS","cartones":"503707, 584518"}]}]",&lt;br&gt;
        "id": 682,&lt;br&gt;
        "identificador": 1378&lt;br&gt;
    },&lt;br&gt;
    "mensaje": "Los resultados se obtuvieron con éxito.",&lt;br&gt;
    "error": false&lt;br&gt;
}";&lt;/p&gt;

&lt;p&gt;// Decodificar el JSON&lt;br&gt;
$data = json_decode($jsonData, true);&lt;br&gt;
$datos = $data['datos'];&lt;br&gt;
$jugadas = json_decode($datos['json'], true);&lt;/p&gt;

&lt;p&gt;?&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;/p&gt;
&lt;br&gt;
    &lt;br&gt;
    &lt;br&gt;
    Resultados de Sorteo&lt;br&gt;
    &amp;lt;br&amp;gt;
        body { font-family: Arial, sans-serif; }&amp;lt;br&amp;gt;
        .jogada { margin-bottom: 20px; }&amp;lt;br&amp;gt;
        .premio { margin-left: 20px; }&amp;lt;br&amp;gt;
        h2 { color: #333; }&amp;lt;br&amp;gt;
        .fecha { font-weight: bold; }&amp;lt;br&amp;gt;
    &lt;br&gt;
&lt;br&gt;


&lt;h1&gt;Resultados del Sorteo&lt;/h1&gt;

&lt;p&gt;Fecha: &lt;/p&gt;

&lt;p&gt;&amp;lt;?php foreach ($jugadas as $jugada): ?&amp;gt;&lt;br&gt;
    &lt;/p&gt;
&lt;br&gt;
        &lt;h2&gt;&amp;lt;?php echo $jugada['nombreJugada']; ?&amp;gt; (ID: &amp;lt;?php echo $jugada['sorteoJugadaId']; ?&amp;gt;)&lt;/h2&gt;
&lt;br&gt;
        &lt;p&gt;&lt;strong&gt;Cantidad de Ganadores:&lt;/strong&gt; &amp;lt;?php echo $jugada['cantidadGanadores']; ?&amp;gt;&lt;/p&gt;
&lt;br&gt;
        &lt;p&gt;&lt;strong&gt;Bolillas:&lt;/strong&gt; &amp;lt;?php echo $jugada['bolillas']; ?&amp;gt;&lt;/p&gt;
&lt;br&gt;
        &lt;p&gt;&lt;strong&gt;¿Es Azar?&lt;/strong&gt; &amp;lt;?php echo $jugada['azar'] ? 'Sí' : 'No'; ?&amp;gt;&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;h3&amp;gt;Premios:&amp;lt;/h3&amp;gt;
    &amp;lt;ul&amp;gt;
        &amp;lt;?php foreach ($jugada['premios'] as $premio): ?&amp;gt;
            &amp;lt;li class="premio"&amp;gt;
                &amp;lt;strong&amp;gt;Premio:&amp;lt;/strong&amp;gt; &amp;lt;?php echo $premio['premio']; ?&amp;gt;, 
                &amp;lt;strong&amp;gt;Número de Ganadores:&amp;lt;/strong&amp;gt; &amp;lt;?php echo $premio['nroGanadores']; ?&amp;gt;, 
                &amp;lt;strong&amp;gt;Aciertos:&amp;lt;/strong&amp;gt; &amp;lt;?php echo $premio['aciertos']; ?&amp;gt;
                &amp;lt;?php if (isset($premio['cartones'])): ?&amp;gt;
                    &amp;lt;br&amp;gt;&amp;lt;strong&amp;gt;Cartones:&amp;lt;/strong&amp;gt; &amp;lt;?php echo $premio['cartones']; ?&amp;gt;
                &amp;lt;?php endif; ?&amp;gt;
            &amp;lt;/li&amp;gt;
        &amp;lt;?php endforeach; ?&amp;gt;
    &amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&amp;lt;?php endforeach; ?&amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;br&gt;
&lt;br&gt;
`&lt;br&gt;
Este código puede leer los &lt;a href="https://ipparaguay.com.py/senete-resultado-por-numero-de-carton/" rel="noopener noreferrer"&gt;resultados de senete por número de cartón&lt;/a&gt; e imprimirlos en cualquier sitio web&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
