Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.36 KB

example_post.php

File metadata and controls

50 lines (39 loc) · 1.36 KB
 
May 19, 2002
May 19, 2002
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
<html>
<head>
<title> IcculusNews 2.0 posting example. </title>
</head>
<body>
<?php
include 'IcculusNews.php';
$starttime = gettimeofday();
$err = NULL;
$queuearray = NULL;
// log in as Anonymous Hoser.
if ($err = news_login($sock, 'localhost'))
$err = "Login failed: $err.";
else
{
// select a news queue. '1' is a safe bet.
if ($err = news_change_queue($sock, 1))
$err = "Failed to select queue: $err.";
else
{
$text = "<font size=\"3\">bitch midget wastin' my digit.</font>";
// post something.
if ($err = news_post($sock, "This is my title", $text))
$err = "Failed to post: $err.";
} // else
} // else
// disconnect from the news daemon, since we're done with it ...
news_logout($sock);
$endtime = gettimeofday();
$totaltime = ((($endtime['sec'] - $starttime['sec']) * 1000) +
(($endtime['usec'] - $starttime['usec']) / 1000));
print("Time spent talking to daemon: $totaltime milliseconds<br>\n");
if (isset($err))
print("<center><font color=\"#FF0000\">$err</font></center><br>\n");
else
print("<center><font color=\"#0000FF\">Text posted</font></center><br>\n");
?>
</body>
</html>