-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnew_bees_stocks.php
49 lines (30 loc) · 1.21 KB
/
new_bees_stocks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
require_once './include/common.php';
//url => https://www.nseindia.com/products-services/indices-nifty500-index
$filename = 'data/bees.csv'; // Replace with your file name or path
// Open the CSV file for reading
$file = fopen($filename, 'r');
while (($line = fgetcsv($file)) !== FALSE) {
$records[] = $line;
}
fclose($file);
array_shift($records); // Removing header
foreach ($records as $record) {
$company = $record[0];
$symbol = $record[1];
$stockType = $record[1];
//$symbol = urlencode($symbol);
$query = "Select id from stockbeeslist where Csymbol = '$symbol'";
$result = mysqli_query($GLOBALS['mysqlConnect'],$query);
$row = mysqli_fetch_assoc($result);
if(empty($row['id'])) {
$company = mysqli_real_escape_string($GLOBALS['mysqlConnect'],$company);
$money_control = "https://www.google.com/search?q=".$symbol."+moneycontrol";
$charink = "https://chartink.com/stocks/$symbol.html";
echo $query = "INSERT INTO stockbeeslist(sName, cSymbol, mcurl, murl, curl, tickertape, industry, ntype) VALUES ('$company','$symbol','$money_control','','$charink','','','N500')";
$result = mysqli_query($GLOBALS['mysqlConnect'],$query);
sleep(1);
echo "\n";
}
}
?>