'contentmonster.',
'cacheOptions' => array(
'cacheDir' => '/tmp/',
'lifetime' => 3600
)
);
$client = XML_RPC2_CachedClient::create('https://contentmonster.ru/api/xmlrpc/', $options);
try {
$subjectList = $client -> subjectList( $apikey );
$getSites = $client -> getSites( $apikey );
} catch (XML_RPC2_FaultException $e) {
die('Exception #' . $e->getFaultCode() . ' : ' . $e->getFaultString());
} catch (Exception $e) {
die('Exception : ' . $e->getMessage());
}
// echo "
";
// print_r( $getSites );
// echo "
";
?>
$value) {
$title = $value[0];
$desc = 'description';
$keywords = '';
$x = count( $value );
if ( $x > 1) {
// Убираем 1-й элемент массива,
//т.к. это основной ключ = название статьи
array_shift( $value );
// и формируем список ключевых слов для статьи
$keywords = implode(", " , $value);
for ($i=1; $i < $x; $i++) {
$params = array(
'site_id' => 10262,
'task' => 1,
'subject_id' => 29,
'write_time_limit' => 36,
'len_min' => 300,
'len_max' => 600,
'write_pay' => 50,
'bezprob' => 1,
'wmtype' => 1,
'payall' => 1,
'uniq_status' => 1,
'uniq_min' => 85,
'name' => $title,
'description' => $desc,
'keywords' => $keywords,
'mdesc' => 1,
'min_desc' => 30,
'max_desc' => 70,
'autoselect' => 1,
'autoselectlevel' => 3,
'nocoment' => 1,
'tender_type' => 1,
'tender_time_limit' => 36
);
}
} else {
// Если в задании не указаны ключевые слова
$params = array(
'site_id' => 10262,
'task' => 1,
'subject_id' => 29,
'write_time_limit' => 36,
'len_min' => 300,
'len_max' => 600,
'write_pay' => 50,
'bezprob' => 1,
'wmtype' => 1,
'payall' => 1,
'uniq_status' => 1,
'uniq_min' => 85,
'name' => $title,
'description' => $desc,
'keywords' => $keywords,
'mdesc' => 1,
'min_desc' => 30,
'max_desc' => 70,
'autoselect' => 1,
'autoselectlevel' => 3,
'nocoment' => 1,
'tender_type' => 1,
'tender_time_limit' => 36
);
}
try {
$createOrder = $client -> createOrder( $apikey, $params );
} catch (XML_RPC2_FaultException $e) {
die('Exception #' . $e->getFaultCode() . ' : ' . $e->getFaultString());
} catch (Exception $e) {
die('Exception : ' . $e->getMessage());
}
if ( $createOrder ) {
echo "Заказ размещен
";
} else {
echo "ошибка :(
";
}
}
}
?>