本文整理汇总了PHP中Uploader::setUserAgent方法的典型用法代码示例。如果您正苦于以下问题:PHP Uploader::setUserAgent方法的具体用法?PHP Uploader::setUserAgent怎么用?PHP Uploader::setUserAgent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uploader
的用法示例。
在下文中一共展示了Uploader::setUserAgent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
die($license_text);
}
// If --filelist is not set, provide one by default
if (!isset($filelist)) {
$filelist = 'filelist.csv';
}
if ($filelist == 'stdin') {
$handler = @fopen('php://stdin', 'r') or die("Error: No valid fileist data found\n");
} else {
$handler = @fopen($filelist, 'r') or die("\nError: No valid filelist data found\n");
}
stream_set_blocking($handler, 1);
// Call the class Commons and login in
$wiki = new Uploader();
$wiki->url = $project;
$wiki->setUserAgent('User-Agent: FooBot (http://mediawiki.org/wiki/User:FooBot)');
$wiki->login($user, $password);
while (($data = fgetcsv($handler, 2097152, ";", "'")) !== FALSE) {
// Get the values from the CSV
$filename = realpath($data[0]);
$pagename = $data[1];
$description = str_replace('\\n', "\n", stripcslashes($data[2]));
$date = $data[3];
$source = stripcslashes($data[4]);
$author = stripcslashes($data[5]);
$optional = stripcslashes($data[6]);
$license = stripcslashes($data[7]);
$categories = stripcslashes($data[8]);
$categories .= "\n[[Category:Files uploaded with Davod Uploader]]";
$summary = stripcslashes($data[9]);
var_dump($wiki->upload($filename, $pagename, $description, $date, $source, $author, $optional, $license, $categories, $summary));