Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function get_content($url)
- {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- ob_start();
- curl_exec($ch);
- curl_close($ch);
- $string = ob_get_contents();
- ob_end_clean();
- $string = html_entity_decode($string);
- $string = html_entity_decode($string);
- return $string;
- }
- $api = "api.viedemerde.fr";
- $key = "readonly";
- $page = "view/random";
- $version = get_content("http://$api/version");
- $content = utf8_decode(get_content("http://$api/$version/$page?key=$key"));
- preg_match('/<vdm id=\"(.*)\">/', $content, $matches);
- $id = $matches[1];
- preg_match('/<auteur>(.*)<\/auteur>/', $content, $matches);
- $auteur = $matches[1];
- preg_match('/<categorie>(.*)<\/categorie>/', $content, $matches);
- $categorie = $matches[1];
- preg_match('/<texte>(.*)<\/texte>/', $content, $matches);
- $texte = $matches[1];
- preg_match('/<date>(.*)<\/date>/', $content, $matches);
- $date = date("\l\e d/m/y �H:i", strtotime($matches[1]));
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
- <head>
- <title><?php echo $auteur; ?> a une vie de merde...</title>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
- </head>
- <body>
- <hr />
- <div>
- <?php echo "$auteur a une vie de merde ($categorie - $date) [$id]"; ?>
- </div>
- <hr />
- <div>
- <?php echo $texte; ?>.
- </div>
- <hr />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment