דילוג לתוכן
  • חוקי הפורום
  • פופולרי
  • לא נפתר
  • משתמשים
  • חיפוש גוגל בפורום
  • צור קשר
עיצובים
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • ברירת מחדל (ללא עיצוב (ברירת מחדל))
  • ללא עיצוב (ברירת מחדל)
כיווץ
מתמחים טופ
  1. דף הבית
  2. מחשבים וטכנולוגיה
  3. רשתות
  4. בקשת מידע | API של פקע"ר

בקשת מידע | API של פקע"ר

מתוזמן נעוץ נעול הועבר רשתות
42 פוסטים 4 כותבים 296 צפיות 2 עוקבים
  • מהישן לחדש
  • מהחדש לישן
  • הכי הרבה הצבעות
תגובה
  • תגובה כנושא
התחברו כדי לפרסם תגובה
נושא זה נמחק. רק משתמשים עם הרשאות מתאימות יוכלו לצפות בו.
  • י יוסי רחמים

    @יהודי-זה-הכי

    <?php
    // =================================================================
    //      API לקבלת התראות פיקוד העורף - גרסת cURL משופרת
    // =================================================================
    
    // קובעים את אזור הזמן לישראל
    date_default_timezone_set('Asia/Jerusalem');
    
    // ============== CORS Headers ==============
    header("Access-Control-Allow-Origin: *");
    header("Content-Type: application/json; charset=utf-8");
    header("Access-Control-Allow-Methods: GET");
    header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
    
    // כתובת ה-API של פיקוד העורף
    $apiUrl = 'https://www.oref.org.il/WarningMessages/alert/alerts.json';
    
    // 1. אתחול cURL
    $ch = curl_init();
    
    // 2. הגדרת האפשרויות של cURL
    // הגדרת הכתובת לביצוע הבקשה
    curl_setopt($ch, CURLOPT_URL, $apiUrl);
    
    // החזרת התוצאה כמחרוזת במקום להדפיס אותה ישירות
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    // הגדרת Headers כדי לדמות דפדפן אמיתי
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Referer: https://www.oref.org.il/',
        'X-Requested-With: XMLHttpRequest',
        'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'
    ]);
    
    // הגדרת זמן קצוב (timeout) של 10 שניות לחיבור
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    
    // עקיבת אחר הפניות מחדש (redirects) אם יש
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    
    // אימות תעודת SSL של השרת (חשוב לאבטחה)
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    
    // 3. ביצוע הבקשה
    $rawResponse = curl_exec($ch);
    
    // יצירת מערך שיכיל את התגובה הסופית
    $response = [];
    
    // 4. בדיקת שגיאות
    if (curl_errno($ch)) {
        // אם הייתה שגיאת cURL (למשל, אין תקשורת, timeout)
        http_response_code(500);
        $response = [
            'status' => 'error',
            'message' => 'Failed to connect to Oref server. cURL Error: ' . curl_error($ch),
            'timestamp' => date('c')
        ];
    } else {
        // אם הבקשה הצליחה
        $alertsData = json_decode($rawResponse, true);
    
        if (empty($alertsData) || !isset($alertsData['data']) || empty($alertsData['data'])) {
            $response = [
                'status' => 'success',
                'alerts_active' => false,
                'data' => null,
                'message' => 'No active alerts.',
                'timestamp' => date('c')
            ];
        } else {
            $response = [
                'status' => 'success',
                'alerts_active' => true,
                'data' => [
                    'id' => $alertsData['id'],
                    'title' => $alertsData['title'],
                    'locations' => $alertsData['data']
                ],
                'timestamp' => date('c')
            ];
        }
    }
    
    // 5. סגירת cURL
    curl_close($ch);
    
    // הדפסת התגובה בפורמט JSON
    echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
    
    ?>
    
    י מנותק
    י מנותק
    יהודי זה הכי
    כתב נערך לאחרונה על ידי
    #32

    @יוסי-רחמים אני רוצה לשאוב את מה שכבר מתקבל אצלך כי אין לי גישה לAPI של פקע"ר כי השרת שלי לא בארץ
    ואגב הוא בודק גם כשהאתר סגור?

    י תגובה 1 תגובה אחרונה
    0
    • י יהודי זה הכי

      @יוסי-רחמים אני רוצה לשאוב את מה שכבר מתקבל אצלך כי אין לי גישה לAPI של פקע"ר כי השרת שלי לא בארץ
      ואגב הוא בודק גם כשהאתר סגור?

      י מנותק
      י מנותק
      יוסי רחמים
      כתב נערך לאחרונה על ידי
      #33

      @יהודי-זה-הכי

      @יהודי-זה-הכי כתב בבקשת מידע | API של פקע"ר:

      כי השרת שלי לא בארץ

      זה לא משנה.

      ואגב הוא בודק גם כשהאתר סגור?

      לא(איך הוא יבדוק?)

      י תגובה 1 תגובה אחרונה
      0
      • י יוסי רחמים

        @יהודי-זה-הכי

        @יהודי-זה-הכי כתב בבקשת מידע | API של פקע"ר:

        כי השרת שלי לא בארץ

        זה לא משנה.

        ואגב הוא בודק גם כשהאתר סגור?

        לא(איך הוא יבדוק?)

        י מנותק
        י מנותק
        יהודי זה הכי
        כתב נערך לאחרונה על ידי
        #34

        @יוסי-רחמים לא יודע?

        י תגובה 1 תגובה אחרונה
        0
        • י יהודי זה הכי

          @יוסי-רחמים לא יודע?

          י מנותק
          י מנותק
          יוסי רחמים
          כתב נערך לאחרונה על ידי
          #35

          @יהודי-זה-הכי לגבי אם הוא בודק אם האתר סגור?
          אם זה פועל ברקע אז כן אם לא אז לא

          תגובה 1 תגובה אחרונה
          0
          • י מנותק
            י מנותק
            יהודי זה הכי
            כתב נערך לאחרונה על ידי יהודי זה הכי
            #36

            אני עשיתי את זה וזה לא מצליח להתחבר לשרת ואני רוצה לדעת איך אפשר כן להתחבר

            index.php

            <!DOCTYPE html>
            <html lang="he" dir="rtl">
            <head>
            <meta charset="UTF-8" />
            <meta name="viewport" content="width=device-width, initial-scale=1" />
            <title>🎗️האלפון של הזירה הית🎗️</title>
            <link rel="icon" href="https://lh3.googleusercontent.com/a/ACg8ocLCPoxjLoSems6ya7IDqC2PPZ8pbKjT6MCpYDvD9_yU2-tcV6JQ=s288-c-no" type="image/png" />
            
            <meta name="description" content="האלפון של הזירה הית">
            <meta name="keywords" content="תגיותב">
            
            <style>
              body {
                font-family: Arial, sans-serif;
                text-align: center;
                background-image: url("https://i.ibb.co/Q3fVHtsZ/unnamed.png");
                background-size: cover;
                background-position: center;
                background-repeat: no-repeat;
                padding: 80px 20px 100px 20px;
                position: relative;
                direction: rtl;
              }
              .container {
                background-color: rgba(255, 255, 255, 0.8);
                padding: 20px;
                border-radius: 10px;
                box-shadow: 0 0 10px rgba(0,0,0,0.1);
                display: inline-block;
                text-align: right;
                margin: 10px auto;
                max-width: 600px;
                width: 100%;
              }
              .input-group {
                display: flex;
                align-items: center;
                margin: 10px 0;
              }
              .input-group input {
                flex: 1;
                padding: 10px;
                border: 1px solid #ccc;
                border-radius: 5px 0 0 5px;
                font-size: 16px;
                direction: rtl;
              }
              .input-group span {
                padding: 10px;
                background-color: #0073e6;
                color: white;
                border-radius: 0 5px 5px 0;
                cursor: default;
              }
              button {
                padding: 10px 20px;
                border: none;
                background-color: #0073e6;
                color: white;
                border-radius: 5px;
                cursor: pointer;
                margin: 5px 0;
                font-size: 16px;
              }
              button:hover {
                background-color: #005bb5;
              }
              .footer {
                margin-top: 30px;
                padding: 10px;
                background-color: rgba(221, 221, 221, 0.8);
                border-radius: 5px;
                font-size: 14px;
                max-width: 600px;
                margin-left: auto;
                margin-right: auto;
              }
              #results {
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                margin-top: 20px;
                gap: 15px;
              }
              .result-item {
                background-color: rgba(255, 255, 255, 0.8);
                border-radius: 8px;
                border: 1px solid #ddd;
                width: 250px;
                min-height: 160px;
                padding: 15px;
                box-sizing: border-box;
                text-align: right;
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                position: relative;
              }
              .result-item strong {
                font-size: 16px;
              }
              .details-btn {
                margin-top: 10px;
                align-self: flex-start;
                background-color: #28a745;
              }
              .details-btn:hover {
                background-color: #1e7e34;
              }
              /* חלון קופץ לפרטים */
              #detailsModal {
                display: none;
                position: fixed;
                z-index: 1500;
                left: 0; top: 0;
                width: 100%; height: 100%;
                background-color: rgba(0,0,0,0.5);
                overflow: auto;
                justify-content: center;
                align-items: center;
                display: flex;
              }
              #detailsModal.hidden {
                display: none !important;
              }
              #detailsModalContent {
                background-color: white;
                padding: 20px 30px;
                border-radius: 10px;
                max-width: 400px;
                width: 90%;
                text-align: right;
                font-size: 18px;
                position: relative;
                box-sizing: border-box;
              }
              #closeModalBtn {
                position: absolute;
                top: 10px;
                left: 10px;
                background-color: #dc3545;
                border: none;
                color: white;
                font-size: 18px;
                padding: 5px 10px;
                border-radius: 5px;
                cursor: pointer;
              }
              #closeModalBtn:hover {
                background-color: #a71d2a;
              }
              #showMapBtn {
                margin-top: 15px;
                background-color: #0073e6;
                color: white;
                padding: 10px 15px;
                border: none;
                border-radius: 5px;
                cursor: pointer;
                font-size: 16px;
              }
              #showMapBtn:hover {
                background-color: #005bb5;
              }
              /* חלון קופץ למפה */
              #mapModal {
                display: none;
                position: fixed;
                z-index: 1600;
                left: 0; top: 0;
                width: 100vw; height: 100vh;
                background-color: rgba(0,0,0,0.7);
                justify-content: center;
                align-items: center;
                display: flex;
              }
              #mapModal.hidden {
                display: none !important;
              }
              #mapContent {
                position: relative;
                background: white;
                border-radius: 10px;
                width: 90%;
                max-width: 600px;
                height: 400px;
                box-sizing: border-box;
                padding-top: 35px;
              }
              #closeMapBtn {
                position: absolute;
                top: 8px; right: 8px;
                background: #dc3545;
                border: none;
                color: white;
                font-size: 16px;
                padding: 6px 10px;
                border-radius: 5px;
                cursor: pointer;
                z-index: 10;
              }
              #closeMapBtn:hover {
                background: #b02a37;
              }
              #mapIframe {
                width: 100%;
                height: 100%;
                border: none;
                border-radius: 0 0 10px 10px;
                display: block;
              }
              /* משחק נחש */
              #snakeGameContainer {
                display: none;
                position: fixed;
                bottom: 10px;
                left: 10px;
                background-color: rgba(255,255,255,0.8);
                padding: 10px;
                border-radius: 10px;
                box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
                z-index: 1000;
              }
            
              /* pagination controls */
              #paginationControls {
                text-align: center;
                margin-top: 10px;
                max-width: 600px;
                margin-left: auto;
                margin-right: auto;
              }
              #paginationControls button {
                margin: 0 10px;
                padding: 8px 16px;
                font-size: 14px;
              }
            
              /* results per page selector */
              #resultsPerPageContainer {
                max-width: 600px;
                margin: 10px auto 0 auto;
                text-align: right;
              }
            
              /* הוספת תיבת התראות צבע אדום במקום הטלפון */
              .phone-box {
                position: fixed;
                top: 120px;
                right: 15px;
                width: 260px;
                height: 480px;
                background: #222;
                border-radius: 30px;
                border: 6px solid #000;
                box-shadow: 0 0 20px rgba(0,0,0,0.5);
                z-index: 9999;
                overflow: hidden;
                display: flex;
                flex-direction: column;
              }
              .phone-box .screen {
                background: #fff;
                height: 100%;
                display: flex;
                flex-direction: column;
                align-items: stretch;
                justify-content: flex-start;
                direction: rtl;
                overflow: hidden;
              }
              #alert-box {
                flex: 1;
                overflow-y: auto;
                padding: 10px;
              }
              #alert-box .message {
                padding: 10px;
                font-size: 14px;
                text-align: right;
                border-bottom: 1px solid #ddd;
                background-color: #fff;
                color: #c0392b;
              }
              .phone-box .controls {
                background: #111;
                padding: 10px;
                text-align: center;
                user-select: none;
              }
              .phone-box .controls button {
                margin: 2px;
                padding: 5px 10px;
                font-size: 14px;
                cursor: pointer;
                border-radius: 5px;
                border: none;
                background-color: #0073e6;
                color: white;
              }
              .phone-box .controls button:hover {
                background-color: #005bb5;
              }
            </style>
            </head>
            
            <body>
            
            <div id="bthn" lang="he"></div>
            <script>
             (function () {
               var script = document.createElement("script");
               script.type = "text/javascript";
               script.src = "https://bringthemhomenow.net/1.3.0/hostages-ticker.js";
               script.setAttribute(
                 "integrity",
                 "sha384-MmP7bD5QEJWvJccg9c0lDnn3LjjqQWDiRCxRV+NU8hij15icuwb29Jfw1TqJwuSv"
               );
               script.setAttribute("crossorigin", "anonymous");
               document.getElementsByTagName("head")[0].appendChild(script);
             })();
            </script>
            
            <h1>📖 🎗️האלפון של הזירה הית 🎗️📖</h1>
            <h1>שימו לב האלפון בשלבי בנייה ופיתוח ייתכנו תקלות</h1>
            
            <!-- תיבת ההתראות בצבע אדום - הטלפון בצד ימין -->
            <div class="phone-box" role="region" aria-label="התראות צבע אדום">
              <div class="screen">
                <div id="alert-box" aria-live="polite" aria-relevant="additions">
                  <div class="message">📞 האלפון מתעדכן מדי יום!</div>
                </div>
                <div class="controls" role="group" aria-label="כפתורי עדכון התראות">
                  <button onclick="fetchAlerts()" aria-label="עדכן התראות צבע אדום">🔄 עדכן</button>
                  <button onclick="sendTestAlert()" aria-label="שלח התראת בדיקה">🧪 בדיקה</button>
                </div>
              </div>
            </div>
            
            <!-- מערכת חיפוש -->
            <div class="container">
                <h2>🔍 מערכת חיפוש</h2>
                <div class="input-group">
                    <span>🔍</span>
                    <input
                        type="text"
                        id="searchInput"
                        placeholder="הקלד שם, כתובת או מספר טלפון"
                        onkeydown="if(event.key === 'Enter') searchData()"
                    />
                </div>
                <button onclick="searchData()">חפש</button>
            
                <!-- בחירת מספר תוצאות בדף -->
                <div id="resultsPerPageContainer" style="display:none;">
                  <label for="resultsPerPage">הצג תוצאות בכל דף: </label>
                  <select id="resultsPerPage" onchange="renderResults()">
                    <option value="5">5</option>
                    <option value="10" selected>10</option>
                    <option value="20">20</option>
                  </select>
                </div>
            
                <div id="results"></div>
            <div id="paginationControls" style="display:none;">
              <button onclick="changePage(1)" id="nextBtn" disabled>הבא ➡</button>
              <span id="pageInfo" style="margin: 0 10px;"></span>
              <button onclick="changePage(-1)" id="prevBtn" disabled>⬅ קודם</button>
            </div>
            </div>
            
            <!-- חלון קופץ לפרטים -->
            <div id="detailsModal" class="hidden" aria-modal="true" role="dialog" aria-labelledby="detailsTitle">
                <div id="detailsModalContent">
                    <button id="closeModalBtn" onclick="closeDetails()" aria-label="סגור חלון">✖</button>
                    <div id="detailsContent" dir="rtl"></div>
                    <button id="showMapBtn" onclick="openMap()" style="display:none;">הצג מיקום במפה</button>
                </div>
            </div>
            
            <!-- חלון קופץ למפה -->
            <div id="mapModal" class="hidden" aria-modal="true" role="dialog" aria-labelledby="mapTitle" aria-hidden="true">
                <div id="mapContent">
                    <button id="closeMapBtn" onclick="closeMap()" aria-label="סגור מפה">✖</button>
                    <iframe id="mapIframe" src="" allowfullscreen loading="lazy" title="מפת מיקום"></iframe>
                </div>
            </div>
            
            <!-- כפתור למשחק נחש -->
            <button onclick="openSnakeGame()" style="position: fixed; bottom: 80px; left: 10px;">
                🎮 שחק נחש
            </button>
            <div
                id="snakeGameContainer"
                style="display: none; position: fixed; bottom: 10px; left: 10px; background-color: rgba(255,255,255,0.8); padding: 10px; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); z-index: 1000;">
                <button onclick="closeSnakeGame()" style="float: left;">❌ סגור</button>
                <h3>🐍 משחק נחש</h3>
                <canvas
                    id="snakeCanvas"
                    width="300"
                    height="300"
                    style="background-color: #f4f4f4">
                </canvas>
            </div>
            
            <!-- תחתית -->
            <div class="footer">
                <p>📢 הפיתוח נעשה בחסות <strong>הזירה הית</strong> - המרחב החם של הציבור הי</p>
                <p>☎️ טלפון: 02-313-60-90</p>
                <p>🛠️ פיתוח ע"י <strong>אבי ש.</strong> אל תדאגו נעזרתי בבינה מלאכותית 😋😋😋 אני לא כזה מומחה</p>
                <p>💬 לכניסה לצ'אט: <a href="https://chat.google.com/room/AAQApcvo9RM?cls=7" target="_blank" rel="noopener noreferrer">לחץ כאן</a></p>
                <p>📧 להצטרפות שלח מייל ל: <a href="mailto:avshainin@gmail.com">avshainin@gmail.com</a></p>
                <p>© 2025 הזירה הית</p>
            </div>
            
            <script>
            let currentResults = [];
            let currentPage = 1;
            let resultsPerPage = 10;
            
            function searchData() {
                let input = document.getElementById("searchInput").value.trim();
                const resultsDiv = document.getElementById("results");
                const paginationControls = document.getElementById("paginationControls");
                const resultsPerPageContainer = document.getElementById("resultsPerPageContainer");
            
                resultsDiv.innerHTML = "🔍 טוען...";
                paginationControls.style.display = "none";
                resultsPerPageContainer.style.display = "none";
            
                fetch("get.php")
                    .then(res => res.json())
                    .then(database => {
                        let results = database.filter(item =>
                            item["שם"].includes(input) ||
                            item["כתובת"].includes(input) ||
                            item["פלאפון"].includes(input)
                        );
            
                        results.sort((a, b) => a["שם"].localeCompare(b["שם"], "he", { sensitivity: "base" }));
            
                        currentResults = results;
                        currentPage = 1;
            
                        if(results.length === 0) {
                            resultsDiv.innerHTML = "❌ לא נמצאו תוצאות";
                            paginationControls.style.display = "none";
                            resultsPerPageContainer.style.display = "none";
                            return;
                        }
            
                        paginationControls.style.display = "block";
                        resultsPerPageContainer.style.display = "block";
            
                        renderResults();
                    })
                    .catch(() => {
                        resultsDiv.innerHTML = "❌ קרתה שגיאה בטעינת הנתונים";
                        paginationControls.style.display = "none";
                        resultsPerPageContainer.style.display = "none";
                    });
            }
            
            function renderResults() {
                const resultsDiv = document.getElementById("results");
                resultsPerPage = parseInt(document.getElementById("resultsPerPage").value);
            
                const startIndex = (currentPage -1) * resultsPerPage;
                const endIndex = startIndex + resultsPerPage;
                const pageResults = currentResults.slice(startIndex, endIndex);
            
                if(pageResults.length === 0 && currentPage > 1) {
                    currentPage--;
                    renderResults();
                    return;
                }
            
                resultsDiv.innerHTML = pageResults.map((item, index) => `
                    <div class="result-item" tabindex="0">
                        <div><strong>שם:</strong> ${item["שם"]}</div>
                        <div><strong>כתובת:</strong> ${item["כתובת"]}</div>
                        <div><strong>פלאפון:</strong> ${item["פלאפון"]}</div>
                        <div><strong>טלפון בבית:</strong> ${item["טלפון בבית"] || "❌"}</div>
                        <div><strong>תא קולי:</strong> ${item["תא קולי"] || "❌"}</div>
                    </div>
                `).join("");
            
                // עדכון כפתורי ניווט
                document.getElementById("pageInfo").textContent = `עמוד ${currentPage} מתוך ${Math.ceil(currentResults.length / resultsPerPage)}`;
                document.getElementById("nextBtn").disabled = currentPage >= Math.ceil(currentResults.length / resultsPerPage);
                document.getElementById("prevBtn").disabled = currentPage <= 1;
            }
            
            function changePage(direction) {
                if(direction === 1 && currentPage < Math.ceil(currentResults.length / resultsPerPage)) {
                    currentPage++;
                } else if(direction === -1 && currentPage > 1) {
                    currentPage--;
                }
                renderResults();
            }
            
            // פונקציות לפרטי איש קשר ומפות (יש למלא בהתאם לצורך שלך)
            function closeDetails() {
                document.getElementById("detailsModal").classList.add("hidden");
            }
            
            function openMap() {
                const modal = document.getElementById("mapModal");
                const iframe = document.getElementById("mapIframe");
                // example of google maps embed, צריך להתאים למיקום בפועל
                iframe.src = "https://maps.google.com/maps?q=32.0804,34.7805&hl=he&z=14&output=embed";
                modal.classList.remove("hidden");
            }
            
            function closeMap() {
                document.getElementById("mapModal").classList.add("hidden");
                document.getElementById("mapIframe").src = "";
            }
            
            // המשחק נחש - פונקציות נפתח וסוגר
            function openSnakeGame() {
                document.getElementById("snakeGameContainer").style.display = "block";
                startSnakeGame();
            }
            function closeSnakeGame() {
                document.getElementById("snakeGameContainer").style.display = "none";
                stopSnakeGame();
            }
            
            let snakeGameInterval = null;
            function startSnakeGame() {
                // כאן לשים את הקוד של משחק הנחש
            }
            function stopSnakeGame() {
                if(snakeGameInterval) {
                    clearInterval(snakeGameInterval);
                    snakeGameInterval = null;
                }
            }
            
            // --- קוד ההתראות צבע אדום ---
            
            const alertBox = document.getElementById("alert-box");
            
            async function fetchAlerts() {
              try {
                const res = await fetch('https://www.oref.org.il/WarningMessages/alert/alerts.json');
                if(!res.ok) throw new Error('Network response was not ok');
                const data = await res.json();
            
                // נקרא לפי מפתח התרעות "alerts"
                const alerts = data["alerts"];
            
                if(!alerts || alerts.length === 0) {
                  alertBox.innerHTML = `<div class="message">📞 אין כרגע התראות צבע אדום</div>`;
                  return;
                }
            
                // הצגת כל ההתראות בקופסה, כל הודעה ב-div נפרד
                alertBox.innerHTML = alerts.map(alert => {
                  // יש גם תאריך התחלה וסיום
                  const start = alert["StartTime"];
                  const end = alert["EndTime"];
                  const region = alert["RegionDesc"] || "";
                  const desc = alert["Message"] || "";
                  // פורמט פשוט
                  return `<div class="message"><strong>🔴 אזור:</strong> ${region}<br><strong>הודעה:</strong> ${desc}<br><small>${start} - ${end}</small></div>`;
                }).join("");
              } catch(err) {
                alertBox.innerHTML = `<div class="message">❌ שגיאה בטעינת ההתראות</div>`;
                console.error("Error fetching alerts:", err);
              }
            }
            
            function sendTestAlert() {
              alertBox.innerHTML = `<div class="message">🧪 זוהי התראת בדיקה - אין התראה אמיתית כרגע</div>`;
            }
            
            // אתחל את ההתראות אוטומטית בהעמסה ועם ריענון כל 2 דקות
            fetchAlerts();
            setInterval(fetchAlerts, 3000);
            
            </script>
            
            </body>
            </html>
            
            
            <?php
            $apiUrl = 'https://api.tzevaadom.co.il/notifications';
            
            function getAlerts($url) {
                $ch = curl_init($url);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                $json = curl_exec($ch);
                $error = curl_error($ch);
                curl_close($ch);
            
                if ($json === false || $json === '') {
                    error_log("שגיאה ב-cURL: " . $error);
                    return null;
                }
            
                $data = json_decode($json, true);
                if ($data === null) {
                    error_log("שגיאה בפענוח JSON");
                }
                return $data;
            }
            
            function saveAlerts($alerts) {
                $file = __DIR__ . '/alerts_history.json';
            
                $existing = [];
                if (file_exists($file)) {
                    $existingJson = file_get_contents($file);
                    $existing = json_decode($existingJson, true);
                    if ($existing === null) $existing = [];
                }
            
                foreach ($alerts as $alert) {
                    $time = $alert['created_at'] ?? '';
                    $location = implode(', ', $alert['data']['locations'] ?? ['מיקום לא ידוע']);
            
                    $exists = false;
                    foreach ($existing as $ex) {
                        if ($ex['time'] === $time) {
                            $exists = true;
                            break;
                        }
                    }
            
                    if (!$exists) {
                        $existing[] = [
                            'time' => $time,
                            'location' => $location,
                        ];
                    }
                }
            
                file_put_contents($file, json_encode($existing, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
            }
            
            $alerts = getAlerts($apiUrl);
            if ($alerts) {
                saveAlerts($alerts);
                echo "התראות נשמרו בהצלחה.\n";
            } else {
                echo "שגיאה בקבלת ההתראות.\n";
            }
            
            

            fetch_and_save_alerts.php

            <?php
            // get_alerts.php
            header('Content-Type: application/json');
            if (file_exists('alerts_log.txt')) {
                $lines = file('alerts_log.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
                $alerts = [];
                foreach ($lines as $line) {
                    $parts = explode(" - ", $line, 2);
                    if (count($parts) === 2) {
                        $alerts[] = ['time' => $parts[0], 'location' => $parts[1]];
                    }
                }
                echo json_encode($alerts);
            } else {
                echo json_encode([]);
            }
            ?>
            
            
            <?php
            // save_alert.php
            if ($_SERVER['REQUEST_METHOD'] === 'POST') {
                $json = file_get_contents('php://input');
                $data = json_decode($json, true);
            
                if ($data && isset($data['time']) && isset($data['location'])) {
                    $entry = $data['time'] . " - " . $data['location'] . "\n";
                    file_put_contents('alerts_log.txt', $entry, FILE_APPEND | LOCK_EX);
                    echo "OK";
                } else {
                    http_response_code(400);
                    echo "Invalid data";
                }
            } else {
                http_response_code(405);
                echo "Method not allowed";
            }
            ?>
            
            
            י תגובה 1 תגובה אחרונה
            0
            • י יהודי זה הכי

              אני עשיתי את זה וזה לא מצליח להתחבר לשרת ואני רוצה לדעת איך אפשר כן להתחבר

              index.php

              <!DOCTYPE html>
              <html lang="he" dir="rtl">
              <head>
              <meta charset="UTF-8" />
              <meta name="viewport" content="width=device-width, initial-scale=1" />
              <title>🎗️האלפון של הזירה הית🎗️</title>
              <link rel="icon" href="https://lh3.googleusercontent.com/a/ACg8ocLCPoxjLoSems6ya7IDqC2PPZ8pbKjT6MCpYDvD9_yU2-tcV6JQ=s288-c-no" type="image/png" />
              
              <meta name="description" content="האלפון של הזירה הית">
              <meta name="keywords" content="תגיותב">
              
              <style>
                body {
                  font-family: Arial, sans-serif;
                  text-align: center;
                  background-image: url("https://i.ibb.co/Q3fVHtsZ/unnamed.png");
                  background-size: cover;
                  background-position: center;
                  background-repeat: no-repeat;
                  padding: 80px 20px 100px 20px;
                  position: relative;
                  direction: rtl;
                }
                .container {
                  background-color: rgba(255, 255, 255, 0.8);
                  padding: 20px;
                  border-radius: 10px;
                  box-shadow: 0 0 10px rgba(0,0,0,0.1);
                  display: inline-block;
                  text-align: right;
                  margin: 10px auto;
                  max-width: 600px;
                  width: 100%;
                }
                .input-group {
                  display: flex;
                  align-items: center;
                  margin: 10px 0;
                }
                .input-group input {
                  flex: 1;
                  padding: 10px;
                  border: 1px solid #ccc;
                  border-radius: 5px 0 0 5px;
                  font-size: 16px;
                  direction: rtl;
                }
                .input-group span {
                  padding: 10px;
                  background-color: #0073e6;
                  color: white;
                  border-radius: 0 5px 5px 0;
                  cursor: default;
                }
                button {
                  padding: 10px 20px;
                  border: none;
                  background-color: #0073e6;
                  color: white;
                  border-radius: 5px;
                  cursor: pointer;
                  margin: 5px 0;
                  font-size: 16px;
                }
                button:hover {
                  background-color: #005bb5;
                }
                .footer {
                  margin-top: 30px;
                  padding: 10px;
                  background-color: rgba(221, 221, 221, 0.8);
                  border-radius: 5px;
                  font-size: 14px;
                  max-width: 600px;
                  margin-left: auto;
                  margin-right: auto;
                }
                #results {
                  display: flex;
                  flex-wrap: wrap;
                  justify-content: center;
                  margin-top: 20px;
                  gap: 15px;
                }
                .result-item {
                  background-color: rgba(255, 255, 255, 0.8);
                  border-radius: 8px;
                  border: 1px solid #ddd;
                  width: 250px;
                  min-height: 160px;
                  padding: 15px;
                  box-sizing: border-box;
                  text-align: right;
                  display: flex;
                  flex-direction: column;
                  justify-content: space-between;
                  position: relative;
                }
                .result-item strong {
                  font-size: 16px;
                }
                .details-btn {
                  margin-top: 10px;
                  align-self: flex-start;
                  background-color: #28a745;
                }
                .details-btn:hover {
                  background-color: #1e7e34;
                }
                /* חלון קופץ לפרטים */
                #detailsModal {
                  display: none;
                  position: fixed;
                  z-index: 1500;
                  left: 0; top: 0;
                  width: 100%; height: 100%;
                  background-color: rgba(0,0,0,0.5);
                  overflow: auto;
                  justify-content: center;
                  align-items: center;
                  display: flex;
                }
                #detailsModal.hidden {
                  display: none !important;
                }
                #detailsModalContent {
                  background-color: white;
                  padding: 20px 30px;
                  border-radius: 10px;
                  max-width: 400px;
                  width: 90%;
                  text-align: right;
                  font-size: 18px;
                  position: relative;
                  box-sizing: border-box;
                }
                #closeModalBtn {
                  position: absolute;
                  top: 10px;
                  left: 10px;
                  background-color: #dc3545;
                  border: none;
                  color: white;
                  font-size: 18px;
                  padding: 5px 10px;
                  border-radius: 5px;
                  cursor: pointer;
                }
                #closeModalBtn:hover {
                  background-color: #a71d2a;
                }
                #showMapBtn {
                  margin-top: 15px;
                  background-color: #0073e6;
                  color: white;
                  padding: 10px 15px;
                  border: none;
                  border-radius: 5px;
                  cursor: pointer;
                  font-size: 16px;
                }
                #showMapBtn:hover {
                  background-color: #005bb5;
                }
                /* חלון קופץ למפה */
                #mapModal {
                  display: none;
                  position: fixed;
                  z-index: 1600;
                  left: 0; top: 0;
                  width: 100vw; height: 100vh;
                  background-color: rgba(0,0,0,0.7);
                  justify-content: center;
                  align-items: center;
                  display: flex;
                }
                #mapModal.hidden {
                  display: none !important;
                }
                #mapContent {
                  position: relative;
                  background: white;
                  border-radius: 10px;
                  width: 90%;
                  max-width: 600px;
                  height: 400px;
                  box-sizing: border-box;
                  padding-top: 35px;
                }
                #closeMapBtn {
                  position: absolute;
                  top: 8px; right: 8px;
                  background: #dc3545;
                  border: none;
                  color: white;
                  font-size: 16px;
                  padding: 6px 10px;
                  border-radius: 5px;
                  cursor: pointer;
                  z-index: 10;
                }
                #closeMapBtn:hover {
                  background: #b02a37;
                }
                #mapIframe {
                  width: 100%;
                  height: 100%;
                  border: none;
                  border-radius: 0 0 10px 10px;
                  display: block;
                }
                /* משחק נחש */
                #snakeGameContainer {
                  display: none;
                  position: fixed;
                  bottom: 10px;
                  left: 10px;
                  background-color: rgba(255,255,255,0.8);
                  padding: 10px;
                  border-radius: 10px;
                  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
                  z-index: 1000;
                }
              
                /* pagination controls */
                #paginationControls {
                  text-align: center;
                  margin-top: 10px;
                  max-width: 600px;
                  margin-left: auto;
                  margin-right: auto;
                }
                #paginationControls button {
                  margin: 0 10px;
                  padding: 8px 16px;
                  font-size: 14px;
                }
              
                /* results per page selector */
                #resultsPerPageContainer {
                  max-width: 600px;
                  margin: 10px auto 0 auto;
                  text-align: right;
                }
              
                /* הוספת תיבת התראות צבע אדום במקום הטלפון */
                .phone-box {
                  position: fixed;
                  top: 120px;
                  right: 15px;
                  width: 260px;
                  height: 480px;
                  background: #222;
                  border-radius: 30px;
                  border: 6px solid #000;
                  box-shadow: 0 0 20px rgba(0,0,0,0.5);
                  z-index: 9999;
                  overflow: hidden;
                  display: flex;
                  flex-direction: column;
                }
                .phone-box .screen {
                  background: #fff;
                  height: 100%;
                  display: flex;
                  flex-direction: column;
                  align-items: stretch;
                  justify-content: flex-start;
                  direction: rtl;
                  overflow: hidden;
                }
                #alert-box {
                  flex: 1;
                  overflow-y: auto;
                  padding: 10px;
                }
                #alert-box .message {
                  padding: 10px;
                  font-size: 14px;
                  text-align: right;
                  border-bottom: 1px solid #ddd;
                  background-color: #fff;
                  color: #c0392b;
                }
                .phone-box .controls {
                  background: #111;
                  padding: 10px;
                  text-align: center;
                  user-select: none;
                }
                .phone-box .controls button {
                  margin: 2px;
                  padding: 5px 10px;
                  font-size: 14px;
                  cursor: pointer;
                  border-radius: 5px;
                  border: none;
                  background-color: #0073e6;
                  color: white;
                }
                .phone-box .controls button:hover {
                  background-color: #005bb5;
                }
              </style>
              </head>
              
              <body>
              
              <div id="bthn" lang="he"></div>
              <script>
               (function () {
                 var script = document.createElement("script");
                 script.type = "text/javascript";
                 script.src = "https://bringthemhomenow.net/1.3.0/hostages-ticker.js";
                 script.setAttribute(
                   "integrity",
                   "sha384-MmP7bD5QEJWvJccg9c0lDnn3LjjqQWDiRCxRV+NU8hij15icuwb29Jfw1TqJwuSv"
                 );
                 script.setAttribute("crossorigin", "anonymous");
                 document.getElementsByTagName("head")[0].appendChild(script);
               })();
              </script>
              
              <h1>📖 🎗️האלפון של הזירה הית 🎗️📖</h1>
              <h1>שימו לב האלפון בשלבי בנייה ופיתוח ייתכנו תקלות</h1>
              
              <!-- תיבת ההתראות בצבע אדום - הטלפון בצד ימין -->
              <div class="phone-box" role="region" aria-label="התראות צבע אדום">
                <div class="screen">
                  <div id="alert-box" aria-live="polite" aria-relevant="additions">
                    <div class="message">📞 האלפון מתעדכן מדי יום!</div>
                  </div>
                  <div class="controls" role="group" aria-label="כפתורי עדכון התראות">
                    <button onclick="fetchAlerts()" aria-label="עדכן התראות צבע אדום">🔄 עדכן</button>
                    <button onclick="sendTestAlert()" aria-label="שלח התראת בדיקה">🧪 בדיקה</button>
                  </div>
                </div>
              </div>
              
              <!-- מערכת חיפוש -->
              <div class="container">
                  <h2>🔍 מערכת חיפוש</h2>
                  <div class="input-group">
                      <span>🔍</span>
                      <input
                          type="text"
                          id="searchInput"
                          placeholder="הקלד שם, כתובת או מספר טלפון"
                          onkeydown="if(event.key === 'Enter') searchData()"
                      />
                  </div>
                  <button onclick="searchData()">חפש</button>
              
                  <!-- בחירת מספר תוצאות בדף -->
                  <div id="resultsPerPageContainer" style="display:none;">
                    <label for="resultsPerPage">הצג תוצאות בכל דף: </label>
                    <select id="resultsPerPage" onchange="renderResults()">
                      <option value="5">5</option>
                      <option value="10" selected>10</option>
                      <option value="20">20</option>
                    </select>
                  </div>
              
                  <div id="results"></div>
              <div id="paginationControls" style="display:none;">
                <button onclick="changePage(1)" id="nextBtn" disabled>הבא ➡</button>
                <span id="pageInfo" style="margin: 0 10px;"></span>
                <button onclick="changePage(-1)" id="prevBtn" disabled>⬅ קודם</button>
              </div>
              </div>
              
              <!-- חלון קופץ לפרטים -->
              <div id="detailsModal" class="hidden" aria-modal="true" role="dialog" aria-labelledby="detailsTitle">
                  <div id="detailsModalContent">
                      <button id="closeModalBtn" onclick="closeDetails()" aria-label="סגור חלון">✖</button>
                      <div id="detailsContent" dir="rtl"></div>
                      <button id="showMapBtn" onclick="openMap()" style="display:none;">הצג מיקום במפה</button>
                  </div>
              </div>
              
              <!-- חלון קופץ למפה -->
              <div id="mapModal" class="hidden" aria-modal="true" role="dialog" aria-labelledby="mapTitle" aria-hidden="true">
                  <div id="mapContent">
                      <button id="closeMapBtn" onclick="closeMap()" aria-label="סגור מפה">✖</button>
                      <iframe id="mapIframe" src="" allowfullscreen loading="lazy" title="מפת מיקום"></iframe>
                  </div>
              </div>
              
              <!-- כפתור למשחק נחש -->
              <button onclick="openSnakeGame()" style="position: fixed; bottom: 80px; left: 10px;">
                  🎮 שחק נחש
              </button>
              <div
                  id="snakeGameContainer"
                  style="display: none; position: fixed; bottom: 10px; left: 10px; background-color: rgba(255,255,255,0.8); padding: 10px; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); z-index: 1000;">
                  <button onclick="closeSnakeGame()" style="float: left;">❌ סגור</button>
                  <h3>🐍 משחק נחש</h3>
                  <canvas
                      id="snakeCanvas"
                      width="300"
                      height="300"
                      style="background-color: #f4f4f4">
                  </canvas>
              </div>
              
              <!-- תחתית -->
              <div class="footer">
                  <p>📢 הפיתוח נעשה בחסות <strong>הזירה הית</strong> - המרחב החם של הציבור הי</p>
                  <p>☎️ טלפון: 02-313-60-90</p>
                  <p>🛠️ פיתוח ע"י <strong>אבי ש.</strong> אל תדאגו נעזרתי בבינה מלאכותית 😋😋😋 אני לא כזה מומחה</p>
                  <p>💬 לכניסה לצ'אט: <a href="https://chat.google.com/room/AAQApcvo9RM?cls=7" target="_blank" rel="noopener noreferrer">לחץ כאן</a></p>
                  <p>📧 להצטרפות שלח מייל ל: <a href="mailto:avshainin@gmail.com">avshainin@gmail.com</a></p>
                  <p>© 2025 הזירה הית</p>
              </div>
              
              <script>
              let currentResults = [];
              let currentPage = 1;
              let resultsPerPage = 10;
              
              function searchData() {
                  let input = document.getElementById("searchInput").value.trim();
                  const resultsDiv = document.getElementById("results");
                  const paginationControls = document.getElementById("paginationControls");
                  const resultsPerPageContainer = document.getElementById("resultsPerPageContainer");
              
                  resultsDiv.innerHTML = "🔍 טוען...";
                  paginationControls.style.display = "none";
                  resultsPerPageContainer.style.display = "none";
              
                  fetch("get.php")
                      .then(res => res.json())
                      .then(database => {
                          let results = database.filter(item =>
                              item["שם"].includes(input) ||
                              item["כתובת"].includes(input) ||
                              item["פלאפון"].includes(input)
                          );
              
                          results.sort((a, b) => a["שם"].localeCompare(b["שם"], "he", { sensitivity: "base" }));
              
                          currentResults = results;
                          currentPage = 1;
              
                          if(results.length === 0) {
                              resultsDiv.innerHTML = "❌ לא נמצאו תוצאות";
                              paginationControls.style.display = "none";
                              resultsPerPageContainer.style.display = "none";
                              return;
                          }
              
                          paginationControls.style.display = "block";
                          resultsPerPageContainer.style.display = "block";
              
                          renderResults();
                      })
                      .catch(() => {
                          resultsDiv.innerHTML = "❌ קרתה שגיאה בטעינת הנתונים";
                          paginationControls.style.display = "none";
                          resultsPerPageContainer.style.display = "none";
                      });
              }
              
              function renderResults() {
                  const resultsDiv = document.getElementById("results");
                  resultsPerPage = parseInt(document.getElementById("resultsPerPage").value);
              
                  const startIndex = (currentPage -1) * resultsPerPage;
                  const endIndex = startIndex + resultsPerPage;
                  const pageResults = currentResults.slice(startIndex, endIndex);
              
                  if(pageResults.length === 0 && currentPage > 1) {
                      currentPage--;
                      renderResults();
                      return;
                  }
              
                  resultsDiv.innerHTML = pageResults.map((item, index) => `
                      <div class="result-item" tabindex="0">
                          <div><strong>שם:</strong> ${item["שם"]}</div>
                          <div><strong>כתובת:</strong> ${item["כתובת"]}</div>
                          <div><strong>פלאפון:</strong> ${item["פלאפון"]}</div>
                          <div><strong>טלפון בבית:</strong> ${item["טלפון בבית"] || "❌"}</div>
                          <div><strong>תא קולי:</strong> ${item["תא קולי"] || "❌"}</div>
                      </div>
                  `).join("");
              
                  // עדכון כפתורי ניווט
                  document.getElementById("pageInfo").textContent = `עמוד ${currentPage} מתוך ${Math.ceil(currentResults.length / resultsPerPage)}`;
                  document.getElementById("nextBtn").disabled = currentPage >= Math.ceil(currentResults.length / resultsPerPage);
                  document.getElementById("prevBtn").disabled = currentPage <= 1;
              }
              
              function changePage(direction) {
                  if(direction === 1 && currentPage < Math.ceil(currentResults.length / resultsPerPage)) {
                      currentPage++;
                  } else if(direction === -1 && currentPage > 1) {
                      currentPage--;
                  }
                  renderResults();
              }
              
              // פונקציות לפרטי איש קשר ומפות (יש למלא בהתאם לצורך שלך)
              function closeDetails() {
                  document.getElementById("detailsModal").classList.add("hidden");
              }
              
              function openMap() {
                  const modal = document.getElementById("mapModal");
                  const iframe = document.getElementById("mapIframe");
                  // example of google maps embed, צריך להתאים למיקום בפועל
                  iframe.src = "https://maps.google.com/maps?q=32.0804,34.7805&hl=he&z=14&output=embed";
                  modal.classList.remove("hidden");
              }
              
              function closeMap() {
                  document.getElementById("mapModal").classList.add("hidden");
                  document.getElementById("mapIframe").src = "";
              }
              
              // המשחק נחש - פונקציות נפתח וסוגר
              function openSnakeGame() {
                  document.getElementById("snakeGameContainer").style.display = "block";
                  startSnakeGame();
              }
              function closeSnakeGame() {
                  document.getElementById("snakeGameContainer").style.display = "none";
                  stopSnakeGame();
              }
              
              let snakeGameInterval = null;
              function startSnakeGame() {
                  // כאן לשים את הקוד של משחק הנחש
              }
              function stopSnakeGame() {
                  if(snakeGameInterval) {
                      clearInterval(snakeGameInterval);
                      snakeGameInterval = null;
                  }
              }
              
              // --- קוד ההתראות צבע אדום ---
              
              const alertBox = document.getElementById("alert-box");
              
              async function fetchAlerts() {
                try {
                  const res = await fetch('https://www.oref.org.il/WarningMessages/alert/alerts.json');
                  if(!res.ok) throw new Error('Network response was not ok');
                  const data = await res.json();
              
                  // נקרא לפי מפתח התרעות "alerts"
                  const alerts = data["alerts"];
              
                  if(!alerts || alerts.length === 0) {
                    alertBox.innerHTML = `<div class="message">📞 אין כרגע התראות צבע אדום</div>`;
                    return;
                  }
              
                  // הצגת כל ההתראות בקופסה, כל הודעה ב-div נפרד
                  alertBox.innerHTML = alerts.map(alert => {
                    // יש גם תאריך התחלה וסיום
                    const start = alert["StartTime"];
                    const end = alert["EndTime"];
                    const region = alert["RegionDesc"] || "";
                    const desc = alert["Message"] || "";
                    // פורמט פשוט
                    return `<div class="message"><strong>🔴 אזור:</strong> ${region}<br><strong>הודעה:</strong> ${desc}<br><small>${start} - ${end}</small></div>`;
                  }).join("");
                } catch(err) {
                  alertBox.innerHTML = `<div class="message">❌ שגיאה בטעינת ההתראות</div>`;
                  console.error("Error fetching alerts:", err);
                }
              }
              
              function sendTestAlert() {
                alertBox.innerHTML = `<div class="message">🧪 זוהי התראת בדיקה - אין התראה אמיתית כרגע</div>`;
              }
              
              // אתחל את ההתראות אוטומטית בהעמסה ועם ריענון כל 2 דקות
              fetchAlerts();
              setInterval(fetchAlerts, 3000);
              
              </script>
              
              </body>
              </html>
              
              
              <?php
              $apiUrl = 'https://api.tzevaadom.co.il/notifications';
              
              function getAlerts($url) {
                  $ch = curl_init($url);
                  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                  curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                  $json = curl_exec($ch);
                  $error = curl_error($ch);
                  curl_close($ch);
              
                  if ($json === false || $json === '') {
                      error_log("שגיאה ב-cURL: " . $error);
                      return null;
                  }
              
                  $data = json_decode($json, true);
                  if ($data === null) {
                      error_log("שגיאה בפענוח JSON");
                  }
                  return $data;
              }
              
              function saveAlerts($alerts) {
                  $file = __DIR__ . '/alerts_history.json';
              
                  $existing = [];
                  if (file_exists($file)) {
                      $existingJson = file_get_contents($file);
                      $existing = json_decode($existingJson, true);
                      if ($existing === null) $existing = [];
                  }
              
                  foreach ($alerts as $alert) {
                      $time = $alert['created_at'] ?? '';
                      $location = implode(', ', $alert['data']['locations'] ?? ['מיקום לא ידוע']);
              
                      $exists = false;
                      foreach ($existing as $ex) {
                          if ($ex['time'] === $time) {
                              $exists = true;
                              break;
                          }
                      }
              
                      if (!$exists) {
                          $existing[] = [
                              'time' => $time,
                              'location' => $location,
                          ];
                      }
                  }
              
                  file_put_contents($file, json_encode($existing, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
              }
              
              $alerts = getAlerts($apiUrl);
              if ($alerts) {
                  saveAlerts($alerts);
                  echo "התראות נשמרו בהצלחה.\n";
              } else {
                  echo "שגיאה בקבלת ההתראות.\n";
              }
              
              

              fetch_and_save_alerts.php

              <?php
              // get_alerts.php
              header('Content-Type: application/json');
              if (file_exists('alerts_log.txt')) {
                  $lines = file('alerts_log.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
                  $alerts = [];
                  foreach ($lines as $line) {
                      $parts = explode(" - ", $line, 2);
                      if (count($parts) === 2) {
                          $alerts[] = ['time' => $parts[0], 'location' => $parts[1]];
                      }
                  }
                  echo json_encode($alerts);
              } else {
                  echo json_encode([]);
              }
              ?>
              
              
              <?php
              // save_alert.php
              if ($_SERVER['REQUEST_METHOD'] === 'POST') {
                  $json = file_get_contents('php://input');
                  $data = json_decode($json, true);
              
                  if ($data && isset($data['time']) && isset($data['location'])) {
                      $entry = $data['time'] . " - " . $data['location'] . "\n";
                      file_put_contents('alerts_log.txt', $entry, FILE_APPEND | LOCK_EX);
                      echo "OK";
                  } else {
                      http_response_code(400);
                      echo "Invalid data";
                  }
              } else {
                  http_response_code(405);
                  echo "Method not allowed";
              }
              ?>
              
              
              י מנותק
              י מנותק
              יוסי רחמים
              כתב נערך לאחרונה על ידי
              #37

              @יהודי-זה-הכי
              1.מה זה כל הקבצים האלה?מה המטרה של כל אחד?
              2.למה אתה משתמש בAPI לא רישמי?(https://api.tzevaadom.co.il/notifications)
              3.תשתמש בקוד שהבאתי לך.

              י 2 תגובות תגובה אחרונה
              0
              • י יוסי רחמים

                @יהודי-זה-הכי
                1.מה זה כל הקבצים האלה?מה המטרה של כל אחד?
                2.למה אתה משתמש בAPI לא רישמי?(https://api.tzevaadom.co.il/notifications)
                3.תשתמש בקוד שהבאתי לך.

                י מנותק
                י מנותק
                יהודי זה הכי
                כתב נערך לאחרונה על ידי
                #38

                @יוסי-רחמים אני לא מסתדר איתו

                י תגובה 1 תגובה אחרונה
                0
                • י יוסי רחמים

                  @יהודי-זה-הכי
                  1.מה זה כל הקבצים האלה?מה המטרה של כל אחד?
                  2.למה אתה משתמש בAPI לא רישמי?(https://api.tzevaadom.co.il/notifications)
                  3.תשתמש בקוד שהבאתי לך.

                  י מנותק
                  י מנותק
                  יהודי זה הכי
                  כתב נערך לאחרונה על ידי יהודי זה הכי
                  #39

                  @יוסי-רחמים כתב בבקשת מידע | API של פקע"ר:

                  3.תשתמש בקוד שהבאתי לך.

                  {
                    "סטטוס": "שגיאה",
                    "message": "נכשל בהתחברות לשרת Oref. שגיאת cURL: נכשל בהתחברות ל-www.oref.org.il פורט 443: החיבור נדחה",
                    "חותמת זמן": "2025-06-23T20:21:03+03:00"
                  }
                  
                  תגובה 1 תגובה אחרונה
                  0
                  • י יהודי זה הכי

                    @יוסי-רחמים אני לא מסתדר איתו

                    י מנותק
                    י מנותק
                    יוסי רחמים
                    כתב נערך לאחרונה על ידי יוסי רחמים
                    #40

                    @יהודי-זה-הכי אז תשאל את AI STUDIO איך להתחבר לPHP שהבאתי לך שנמצא בקובץ
                    https://clarityai-smart-tools.onrender.com/alerts.php

                    וכנראה שיש שגיאה כי אתה לא שולח אליו נתונים טוב
                    כי זה מה שאני מקבל:

                    {
                        "status": "success",
                        "alerts_active": false,
                        "data": null,
                        "message": "No active alerts.",
                        "timestamp": "2025-06-23T20:22:53+03:00"
                    }
                    
                    י תגובה 1 תגובה אחרונה
                    0
                    • י יוסי רחמים

                      @יהודי-זה-הכי אז תשאל את AI STUDIO איך להתחבר לPHP שהבאתי לך שנמצא בקובץ
                      https://clarityai-smart-tools.onrender.com/alerts.php

                      וכנראה שיש שגיאה כי אתה לא שולח אליו נתונים טוב
                      כי זה מה שאני מקבל:

                      {
                          "status": "success",
                          "alerts_active": false,
                          "data": null,
                          "message": "No active alerts.",
                          "timestamp": "2025-06-23T20:22:53+03:00"
                      }
                      
                      י מנותק
                      י מנותק
                      יהודי זה הכי
                      כתב נערך לאחרונה על ידי
                      #41

                      @יוסי-רחמים כתב בבקשת מידע | API של פקע"ר:

                      https://clarityai-smart-tools.onrender.com/alerts.php

                      זה כן טוב

                      אז תשאל את AI STUDIO

                      מי זה?

                      י תגובה 1 תגובה אחרונה
                      0
                      • י יהודי זה הכי

                        @יוסי-רחמים כתב בבקשת מידע | API של פקע"ר:

                        https://clarityai-smart-tools.onrender.com/alerts.php

                        זה כן טוב

                        אז תשאל את AI STUDIO

                        מי זה?

                        י מנותק
                        י מנותק
                        יוסי רחמים
                        כתב נערך לאחרונה על ידי יוסי רחמים
                        #42

                        @יהודי-זה-הכי כתב בבקשת מידע | API של פקע"ר:

                        מי זה?

                        צאט AI חכם במיוחד עם הרבה יכולות😎
                        (AI רגיל... גם GPT טוב...)

                        תגובה 1 תגובה אחרונה
                        0

                        • התחברות

                        • אין לך חשבון עדיין? הרשמה

                        • התחברו או הירשמו כדי לחפש.
                        • פוסט ראשון
                          פוסט אחרון
                        0
                        • חוקי הפורום
                        • פופולרי
                        • לא נפתר
                        • משתמשים
                        • חיפוש גוגל בפורום
                        • צור קשר