-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwitter.php
More file actions
54 lines (48 loc) · 1.34 KB
/
twitter.php
File metadata and controls
54 lines (48 loc) · 1.34 KB
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
<?php
error_reporting(0);
if ($_GET['tweet']) {
$tweet = $_GET['tweet'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://publish.twitter.com/oembed?url='.$tweet.'&lang=es&theme=dark&dnt=true');
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$input = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
$json = json_decode($input, true);
$title = 'Tweet de '.$json['author_name'];
}
else
{
$title = 'Mostrar tweet';
}
?>
<html data-layout-mode="dark">
<head>
<title><?php echo $title; ?></title>
<link rel="icon" type="image/x-icon" href="/img/Bokehlicia-Captiva-Web-twitter-2.32.png">
<style>
body {
padding: 25px;
font-size: 25px;
background-color: black;
color: white;
}
</style>
<meta name="twitter:widgets:theme" content="dark" /><meta name="twitter:widgets:link-color" content="#80ffff" /><meta name="twitter:widgets:border-color" content="#000000" />
</head>
<body>
<?php
if ($_GET['tweet']) {
echo $json['html'];
}
else
{
echo '<form action="twitter.php" method="get">';
echo 'Tweet: <input name="tweet" value="" />';
echo '<button>Ver tweet</button>';
echo '</form>';
}
?>
</body>
</html>