PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my alerts
my settings
my profile
Public Pastes
Untitled
10 sec ago
Untitled
15 sec ago
Untitled
16 sec ago
Untitled
17 sec ago
Untitled
21 sec ago
Untitled
21 sec ago
Untitled
26 sec ago
Untitled
27 sec ago
Houlala
By: a guest on Aug 18th, 2008 | syntax:
PHP
| size: 1.54 KB | hits: 485 | expires: Never
download
|
raw
|
embed
|
report abuse
Copied
<?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 a
new version
of this paste
RAW Paste Data