File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/APPS/CronJobs/Purva/PurvaAllotment.php
Back
<?php include("simple_html_dom.php"); /* ---------------- DB CONNECTION ---------------- */ $con = mysqli_connect("localhost:3306", "marketdatauser", "d7o7A8%s2d7", "marketdataci"); if (mysqli_connect_errno()) { echo "Connection Fail " . mysqli_connect_error(); exit; } mysqli_set_charset($con, "utf8mb4"); function splitIpoNames($raw) { // supports: "Corona, Meesho ,Kahan" $parts = preg_split('/\s*,\s*/', trim((string)$raw)); $out = []; foreach ($parts as $p) { $p = trim($p); if ($p !== '') $out[] = $p; } // unique, keep order return array_values(array_unique($out)); } /* ---------------- Get IPO Names ONLY for Purva ---------------- IMPORTANT: change 'Purva' to 'Purva Share' if that’s how it is stored */ $ipoNames = []; $res = mysqli_query($con, " SELECT ipo_name FROM scraper_servers WHERE is_enabled = 1 AND server_name = 'Purva' AND ipo_name <> '' "); $ipoNames = []; while ($row = mysqli_fetch_assoc($res)) { foreach (splitIpoNames($row['ipo_name']) as $nm) { $ipoNames[] = $nm; } } $ipoNames = array_values(array_unique($ipoNames)); while ($row = mysqli_fetch_assoc($res)) { $ipoNames[] = trim($row['ipo_name']); } if (empty($ipoNames)) { echo "No Purva IPO names found.\n"; exit; } /* ---------------- Fetch Purva page once ---------------- */ $html = file_get_html("https://www.purvashare.com/investor-service/ipo-query"); if (!$html) { echo "Failed to load Purva page.\n"; exit; } /* ✅ Correct dropdown id: company_id */ $list = $html->find('select[id=company_id]', 0); if (!$list) { echo "Company dropdown not found on Purva page.\n"; exit; } /* ---------------- Extract dropdown options ---------------- */ $options = []; foreach ($list->find('option') as $opt) { $txt = trim($opt->plaintext); if ($txt !== '' && strtolower($txt) !== 'select company') { $options[] = $txt; } } /* ---------------- CLI-safe URL logic (NO WARNINGS) ---------------- */ $domain = $_SERVER['SERVER_NAME'] ?? 'cipherteam.in'; $docRoot = $_SERVER['DOCUMENT_ROOT'] ?? ''; $path = $docRoot ? substr(__FILE__, strlen($docRoot)) : basename(__FILE__); $url = "https://" . $domain . "/" . ltrim($path, "/"); $opt = $url; // kept only for compatibility /* ---------------- Check each Purva IPO ---------------- */ foreach ($ipoNames as $name) { foreach ($options as $optText) { if (strpos(strtolower($optText), strtolower($name)) !== false) { $title = $optText . " Allotment Out"; $msg = "Allotment Live At Purva Share"; file_get_contents( "https://cipherteam.in/APPS/CronJobs/IPONEWSFINDERS/senNotification.php?key=PR@TIK@2552" . "&title=" . urlencode($title) . "&message=" . urlencode($msg) ); break; // stop after first match } } } echo "Done. Checked Purva IPOs: " . count($ipoNames) . "\n"; ?>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings