Last active
December 18, 2018 02:39
-
-
Save mkvtvseries/03243b06af702639ffa8fe4278c3b08a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('libs/utils.php'); | |
list( $bot, $host, $username, $password, $post, $title, $content) = $argv; | |
$site = 'https://' . $host . '/xmlrpc.php'; | |
echo ' Posting to Site : '.'https://' . $host.'/'.PHP_EOL; | |
$user = $username; | |
$pass = $password; | |
$title = str_replace(array('_', '.'), ' ', $title); | |
$body = file_get_contents($content); | |
$category = ''; | |
$keywords = ''; | |
wp($site, $user, $pass, $title, $body, $category, $keywords, $post); | |
function wp($site, $user, $pass, $title, $body, $category, $keywords, $post, $encoding = 'UTF-8') | |
{ | |
$title = htmlentities($title, ENT_NOQUOTES, $encoding); | |
$keywords = htmlentities($keywords, ENT_NOQUOTES, $encoding); | |
$category = htmlentities($keywords, ENT_NOQUOTES, $encoding); | |
$content = array( | |
'title' => $title, | |
'description' => $body, | |
'mt_allow_comments' => 1, | |
'mt_allow_pings' => 0, | |
'post_type' => 'post', | |
'mt_keywords' => $keywords, | |
'categories' => array($category) | |
); | |
$params = array(0, $user, $pass, $content, $post); | |
$request = xmlrpc_encode_request('metaWeblog.newPost', $params); | |
var_dump($request); | |
$ch = curl_init(); | |
curl_setopt_array($ch, array( | |
CURLOPT_SSL_VERIFYPEER => false, | |
CURLOPT_SSL_VERIFYHOST => false, | |
CURLOPT_URL => $site, | |
CURLOPT_RETURNTRANSFER => 1, | |
CURLOPT_TIMEOUT => 30, | |
CURLOPT_POSTFIELDS => $request | |
)); | |
$response = curl_exec($ch); | |
var_dump($response); | |
curl_close($ch); | |
return $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment