PPSC — Upcoming Posts
Announcement widget for your site: shows latest requisition notice and quick link to PPSC official website.
New Requisition Prepared
How this page connects to PPSC
This page includes a direct link and a script that will try to fetch the PPSC announcements. Many government sites block cross-origin requests or framing. The script below attempts a safe fetch and falls back to opening the official site in a new tab if blocked.
Latest (attempted) notices
Loading latest notices (if available)...
Developer: example fetch script (front-end)
This front-end fetch will likely be blocked by CORS on PPSC. Use it for testing only.
fetch('https://www.ppsc.gop.pk/announcements')
.then(r => r.text()) .then(html => { document.getElementById('notices').innerText = 'Fetched HTML — parse server-side for real data.' }) .catch(err => { document.getElementById('notices').innerHTML = 'Unable to fetch directly due to CORS. Open official site.' })
Recommended server-side proxy (example, Node.js)
// Example (Node/Express)
// const express = require('express') // const fetch = require('node-fetch') // app.get('/api/ppsc-notices', async (req, res) => { // const r = await fetch('https://www.ppsc.gop.pk/announcements') // const text = await r.text() // // parse the HTML and return JSON to the frontend // res.json({html: text}) // }) 


0 Comments
Post a Comment