pastebin
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
pastebin
Follow @pastebin
create new paste
trending pastes
sign up
login
my settings
my profile
My Pastes
Public Pastes
Untitled
10 sec ago
Untitled
16 sec ago
Untitled
22 sec ago
Untitled
29 sec ago
Untitled
35 sec ago
Hey My Grandma Is A Who...
1 min ago
Untitled
41 sec ago
Untitled
47 sec ago
Layout Width
Share Pastebin
Houlala
By: a guest | Aug 18th, 2008 | Syntax:
PHP
| Size: 1.54 KB | Hits: 484 | Expires: Never
Download
|
Raw
|
Embed
|
Report abuse
<?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>
create new paste
|
create new version of this paste
RAW Paste Data