{"id":5803,"date":"2025-02-06T10:26:23","date_gmt":"2025-02-06T08:26:23","guid":{"rendered":"https:\/\/pixupweb.com\/?page_id=5803"},"modified":"2025-02-06T11:41:31","modified_gmt":"2025-02-06T09:41:31","slug":"testrsss","status":"publish","type":"page","link":"https:\/\/pixupweb.com\/es\/testrsss\/","title":{"rendered":"testrsss"},"content":{"rendered":"<p>rrrrr<\/p>\n<p>&nbsp;<\/p>\n<p><code>\n\n<div class=\"container\">\n    <h1 class=\"my-4\">Llista d'Ofertes<\/h1>\n    <div id=\"ofertes-container\" class=\"row\" data-feed=\"https:\/\/www.simbiosiindustrial.cat\/ofertes\/exportXml.php?coord=41.3873974,2.16856\" data-cols=\"3\">Carregant ofertes...<\/div>\n<\/div>\n    <script>\n        document.addEventListener(\"DOMContentLoaded\", function() {\n            const url = \"https:\/\/www.simbiosiindustrial.cat\/ofertes\/exportXml.php?coord=41.3873974,2.168568&distance=25&tipologia=Subproducte\";\n            fetch(url)\n                .then(response => response.text())\n                .then(str => {\n                    console.log(\"Resposta XML:\", str); \/\/ Depuraci\u00f3\n                    return new window.DOMParser().parseFromString(str, \"text\/xml\");\n                })\n                .then(xml => {\n                    console.log(\"Objecte XML:\", xml); \/\/ Depuraci\u00f3\n                    const ofertes = xml.getElementsByTagName(\"oferta\");\n                    let html = \"\";\n                    \n                    for (let i = 0; i < ofertes.length; i++) {\n                        const titol = ofertes[i].getElementsByTagName(\"titol\")[0]?.textContent || \"Sense t\u00edtol\";\n                        const urlOferta = ofertes[i].getElementsByTagName(\"url\")[0]?.textContent || \"#\";\n                        const preu = ofertes[i].getElementsByTagName(\"preu\")[0]?.textContent || \"Preu no disponible\";\n                        const localitat = ofertes[i].getElementsByTagName(\"localitat\")[0]?.textContent || \"Localitat no especificada\";\n                        const material = ofertes[i].getElementsByTagName(\"material\")[0]?.textContent || \"Material desconegut\";\n                        const tipologia = ofertes[i].getElementsByTagName(\"tipologia\")[0]?.textContent || \"Tipologia no especificada\";\n                        const pes = ofertes[i].getElementsByTagName(\"pes\")[0]?.textContent || \"0\";\n                        const unitat = ofertes[i].getElementsByTagName(\"unitat\")[0]?.textContent || \"Unitat no especificada\";\n                        \n                        html += `<div class=\"item\">\n                                    <a href=\"${urlOferta}\"><h2>${titol}<\/h2><\/a>\n                                    <div class=\"content\">\n                                        <div class=\"price\">Preu: ${preu}\u20ac<\/div>\n                                        <div class=\"loc\">Localitat: ${localitat}<\/div>\n                                        <div class=\"mat\">Material: ${material}<\/div>\n                                        <div class=\"type\">Tipologia: ${tipologia}<\/div>\n                                        <div class=\"weight\">Pes: ${pes}<\/div>\n                                        <div class=\"unit\">Unitat: ${unitat}<\/div>\n                                    <\/div>\n                                 <\/div>`;\n                    }\n                    \n                    document.getElementById(\"ofertes-container\").innerHTML = html;\n                })\n                .catch(error => {\n                    document.getElementById(\"ofertes-container\").innerHTML = \"Error carregant les ofertes.\";\n                    console.error(\"Error carregant l'XML:\", error);\n                });\n        });\n    <\/script>\n\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rrrrr &nbsp;<\/p>\n","protected":false},"author":5,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pixupweb.com\/es\/wp-json\/wp\/v2\/pages\/5803"}],"collection":[{"href":"https:\/\/pixupweb.com\/es\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/pixupweb.com\/es\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/pixupweb.com\/es\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/pixupweb.com\/es\/wp-json\/wp\/v2\/comments?post=5803"}],"version-history":[{"count":8,"href":"https:\/\/pixupweb.com\/es\/wp-json\/wp\/v2\/pages\/5803\/revisions"}],"predecessor-version":[{"id":5867,"href":"https:\/\/pixupweb.com\/es\/wp-json\/wp\/v2\/pages\/5803\/revisions\/5867"}],"wp:attachment":[{"href":"https:\/\/pixupweb.com\/es\/wp-json\/wp\/v2\/media?parent=5803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}