Login   Register  
PHP Classes
elePHPant
Icontem

File: send.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrey Nikishaev  >  Posting to LiveJournal  >  send.php  >  Download  
File: send.php
Role: Example script
Content type: text/plain
Description: Example Script
Class: Posting to LiveJournal
Post an article to a LiveJournal blog
Author: By
Last change:
Date: 6 years ago
Size: 2,362 bytes
 

Contents

Class file image Download
<?php
include('jjport.php');

$port=new port();
$port->add('username',$_REQUEST['user'], 'string');
$port->add('password',$_REQUEST['pass'], 'string');

$date time();
$year date("Y"$date);
$mon date("m"$date);
$day date("d"$date);
$hour date("G"$date);
$min date("i"$date);

$port->add('mon',$mon'int');
$port->add('day',$day'int');
$port->add('year',$year'int');
$port->add('hour',$hour'int');
$port->add('min',$min'int');
//public (default), private and usemask
$port->add('security','public''string');
$port->add('subject',$_REQUEST['title'], 'string');
$port->add("lineendings""unix""string");
$port->add('event',$_REQUEST['text'], 'string');
$port->add('ver','2''int');

$res=$port->send();




if(
array_key_exists("url",$res)) {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
       <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">

        <title>LiveJournal Posting</title>
        <style type="text/css">
body {
margin:0;
padding:0;
background: #f5f5f5;
font-face:Arial;
font-size:12pt;
color:#9FBBEA;
}
div#form {
text-align:center;
width:90%;
font-size:100%;
margin: 0 auto;
text-align:left;
}
h1 {
font-face:Times New Roman;
font-size:26pt;
color:#9FBBEA;
}
</style>
    </head>
    <body>
        <div id="form" align="center">
        <h1>Post created.</h1>
        <a href="<?php echo $res['url']?>"><?php echo $res['url']?></a>

        </div>
     </body>
</html>
<?
} else {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
       <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">

        <title>LiveJournal Posting</title>
        <style type="text/css">
body {
margin:0;
padding:0;
background: #f5f5f5;
font-face:Arial;
font-size:12pt;
color:#9FBBEA;
}
div#form {
text-align:center;
width:90%;
font-size:100%;
margin: 0 auto;
text-align:left;
}
h1 {
font-face:Times New Roman;
font-size:26pt;
color:#9FBBEA;
}
</style>
    </head>
    <body>
        <div id="form" align="center">
        <h1>Error. Post not created.</h1>
        <p>Error code: <?php echo $res['errorcode'?></p>
        <p>Error Text: <?php echo $res['errortext'?></p>
        </div>
     </body>
</html>
<?
}