Skip to content

Instantly share code, notes, and snippets.

@64lines
Last active June 3, 2017 00:47
Show Gist options
  • Select an option

  • Save 64lines/724bfc7a7f29458e11c4d9a910d34881 to your computer and use it in GitHub Desktop.

Select an option

Save 64lines/724bfc7a7f29458e11c4d9a910d34881 to your computer and use it in GitHub Desktop.
Obtener Datos de los Tweets a través de un Servicio PHP
<?php
$servername = "localhost";
$username = "root";
$password = "liferay";
$dbname = "lportal";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$emparray = array();
$sql = "SELECT uuid_, urbanatweetId, userId, userName, createDate, text_, hashtag, retweet, followers, polaridad FROM VZ_Urbanatweet";
$result = $conn->query($sql);
$output = array();
while ($row = mysqli_fetch_assoc($result)) {
$output[] = array_map('utf8_encode', $row);
}
print(json_encode($output));
$conn->close();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment