-
Notifications
You must be signed in to change notification settings - Fork 0
/
title.php
56 lines (41 loc) · 1.15 KB
/
title.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
50
51
52
53
54
55
56
<!DOCTYPE html>
<html>
<body>
<?php
// Username is root
$user = 'root';
$password = '';
// Database name is gfg
$database = 'stockify';
// Server is localhost with
// port number 3306
$servername='localhost:3306';
$mysqli = new mysqli($servername, $user,
$password, $database);
// Checking for connections
if ($mysqli->connect_error) {
die('Connect Error (' .
$mysqli->connect_errno . ') '.
$mysqli->connect_error);
}
// SQL query to select data from database
$sql = "SELECT Links FROM title WHERE Course_Name = 'Stock Market'";
$result = $mysqli->query($sql);
$mysqli->close();
//Getting the title of the youtube video
// LOOP TILL END OF DATA
while($rows=$result->fetch_assoc())
{
?>
<!--FETCHING DATA FROM EACH
ROW OF EVERY COLUMN-->
<?php
$url = $rows['Links'];
$video_info = file_get_contents($url);
parse_str($video_info, $video_info_array);
$title = json_decode($video_info_array['player_response'])->videoDetails->title;
echo $title;
}
?>
</body>
</html>