本文整理汇总了PHP中Http::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::Get方法的具体用法?PHP Http::Get怎么用?PHP Http::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: txDownloadThumb
function txDownloadThumb()
{
global $json, $C;
$out = array('status' => JSON_FAILURE);
$id = md5($_REQUEST['thumb']);
$cachefile = SafeFilename("_{$_REQUEST['gallery_id']}_" . $id . ".jpg", FALSE);
if (!is_file("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}")) {
$http = new Http();
if ($http->Get($_REQUEST['thumb'], TRUE, $_REQUEST['gallery_url'])) {
FileWrite("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}", $http->body);
}
}
$out['size'] = @getimagesize("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}");
if ($out['size'] !== FALSE) {
$out['src'] = "{$C['install_url']}/cache/{$cachefile}";
$out['status'] = JSON_SUCCESS;
} else {
unlink("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}");
}
echo $json->encode($out);
}
示例2: array
function &ScanGallery(&$gallery, &$category, &$whitelisted, $all_images = FALSE)
{
require_once "{$GLOBALS['BASE_DIR']}/includes/http.class.php";
require_once "{$GLOBALS['BASE_DIR']}/includes/htmlparser.class.php";
// Setup default values
$results = array('thumbnails' => 0, 'links' => 0, 'format' => FMT_PICTURES, 'has_recip' => FALSE, 'has_2257' => FALSE, 'thumbs' => array(), 'server_match' => TRUE);
// Download the gallery page
$http = new Http();
$http_result = $http->Get($gallery['gallery_url'], $whitelisted['allow_redirect']);
// Record the request results
$results = array_merge($results, $http->request_info);
$results['page_hash'] = md5($http->body);
$results['gallery_ip'] = GetIpFromUrl($http->end_url);
$results['bytes'] = intval($results['size_download']);
$results['html'] = $http->body;
$results['headers'] = trim($http->raw_response_headers);
$results['status'] = $http->response_headers['status'];
$results['success'] = $http_result;
$results['errstr'] = $http->errstr;
$results['end_url'] = $http->end_url;
if (!$http_result) {
$http_result = null;
return $results;
}
// Check if reciprocal link and 2257 code are present
$results['has_recip'] = CheckReciprocal($http->body);
$results['has_2257'] = Check2257($http->body);
// Extract information from the gallery HTML
$parser = new PageParser($http->end_url, $category['pics_extensions'], $category['movies_extensions']);
$parser->parse($http->body);
$results['links'] = $parser->num_links;
if ($parser->num_content_links > 0) {
if ($parser->num_picture_links > $parser->num_movie_links) {
$results['format'] = FMT_PICTURES;
$results['thumbnails'] = $parser->num_picture_links;
$results['preview'] = $parser->thumbs['pictures'][array_rand($parser->thumbs['pictures'])]['full'];
$results['thumbs'] = array_values($parser->thumbs['pictures']);
} else {
$results['format'] = FMT_MOVIES;
$results['thumbnails'] = $parser->num_movie_links;
$results['preview'] = $parser->thumbs['movies'][array_rand($parser->thumbs['movies'])]['full'];
$results['thumbs'] = array_values($parser->thumbs['movies']);
}
} else {
if ($all_images) {
$results['thumbnails'] = count($parser->images);
$results['preview'] = $parser->images[array_rand($parser->images)]['full'];
$results['thumbs'] = array_values($parser->images);
}
}
// Check that gallery content is hosted on same server as the gallery itself
$parsed_gallery_url = parse_url($results['end_url']);
$parsed_gallery_url['host'] = preg_quote(preg_replace('~^www\\.~', '', $parsed_gallery_url['host']));
foreach ($results['thumbs'] as $thumb) {
$parsed_content_url = parse_url($thumb['content']);
if (!preg_match("~{$parsed_gallery_url['host']}~", $parsed_content_url['host'])) {
$results['server_match'] = FALSE;
break;
}
}
$parser->Cleanup();
unset($parser);
$http->Cleanup();
unset($http);
return $results;
}
示例3: tlxAccountAdd
function tlxAccountAdd()
{
global $C, $DB, $L, $IMAGE_EXTENSIONS, $t;
unset($_REQUEST['banner_url_local']);
// Get domain
$parsed_url = parse_url($_REQUEST['site_url']);
$_REQUEST['domain'] = preg_replace('~^www\\.~', '', $parsed_url['host']);
$v = new Validator();
// Get selected category (if any) and set variables
if (isset($_REQUEST['category_id'])) {
$category = $DB->Row('SELECT * FROM `tlx_categories` WHERE `category_id`=? AND `hidden`=0', array($_REQUEST['category_id']));
if ($category) {
$C['min_desc_length'] = $category['desc_min_length'];
$C['max_desc_length'] = $category['desc_max_length'];
$C['min_title_length'] = $category['title_min_length'];
$C['max_title_length'] = $category['title_max_length'];
$C['banner_max_width'] = $category['banner_max_width'];
$C['banner_max_height'] = $category['banner_max_height'];
$C['banner_max_bytes'] = $category['banner_max_bytes'];
$C['allow_redirect'] = $category['allow_redirect'];
} else {
$v->SetError($L['INVALID_CATEGORY']);
}
}
// See if username is taken
if ($DB->Count('SELECT COUNT(*) FROM `tlx_accounts` WHERE `username`=?', array($_REQUEST['username'])) > 0) {
$v->SetError($L['USERNAME_TAKEN']);
}
// Check for duplicate account information
if ($DB->Count('SELECT COUNT(*) FROM `tlx_accounts` WHERE `site_url`=? OR `email`=? OR `domain`=?', array($_REQUEST['site_url'], $_REQUEST['email'], $_REQUEST['domain'])) > 0) {
$v->SetError($L['EXISTING_ACCOUNT']);
}
$v->Register($_REQUEST['username'], V_LENGTH, $L['USERNAME_LENGTH'], '4,32');
$v->Register($_REQUEST['username'], V_ALPHANUM, $L['INVALID_USERNAME']);
$v->Register($_REQUEST['password'], V_LENGTH, $L['PASSWORD_LENGTH'], '4,9999');
$v->Register($_REQUEST['email'], V_EMAIL, $L['INVALID_EMAIL']);
$v->Register($_REQUEST['site_url'], V_URL, sprintf($L['INVALID_URL'], $L['SITE_URL']));
$v->Register($_REQUEST['password'], V_NOT_EQUALS, $L['USERNAME_IS_PASSWORD'], $_REQUEST['username']);
$v->Register($_REQUEST['password'], V_EQUALS, $L['PASSWORDS_DONT_MATCH'], $_REQUEST['confirm_password']);
if (!IsEmptyString($_REQUEST['banner_url'])) {
$v->Register($_REQUEST['banner_url'], V_URL, sprintf($L['INVALID_URL'], $L['BANNER_URL']));
}
// Format keywords and check number
if ($C['allow_keywords']) {
$_REQUEST['keywords'] = FormatSpaceSeparated($_REQUEST['keywords']);
$keywords = explode(' ', $_REQUEST['keywords']);
$v->Register(count($keywords), V_LESS_EQ, sprintf($L['MAXIMUM_KEYWORDS'], $C['max_keywords']), $C['max_keywords']);
} else {
$_REQUEST['keywords'] = null;
}
// Verify captcha code
if ($C['account_add_captcha']) {
VerifyCaptcha($v);
}
// Initial validation
if (!$v->Validate()) {
return $v->ValidationError('tlxShAccountAdd', TRUE);
}
// Check if the site URL is working
$http = new Http();
if ($http->Get($_REQUEST['site_url'], $C['allow_redirect'])) {
$_REQUEST['html'] = $http->body;
$_REQUEST['headers'] = $http->raw_response_headers;
} else {
$v->SetError(sprintf($L['BROKEN_URL'], $_REQUEST['site_url'], $http->errstr));
}
// Check the blacklist
$blacklisted = CheckBlacklistAccount($_REQUEST);
if ($blacklisted !== FALSE) {
$v->SetError(sprintf($blacklisted[0]['reason'] ? $L['BLACKLISTED_REASON'] : $L['BLACKLISTED'], $blacklisted[0]['match'], $blacklisted[0]['reason']));
}
// Check site title and description length
$v->Register($_REQUEST['title'], V_LENGTH, sprintf($L['TITLE_LENGTH'], $C['min_title_length'], $C['max_title_length']), "{$C['min_title_length']},{$C['max_title_length']}");
$v->Register($_REQUEST['description'], V_LENGTH, sprintf($L['DESCRIPTION_LENGTH'], $C['min_desc_length'], $C['max_desc_length']), "{$C['min_desc_length']},{$C['max_desc_length']}");
// Validation of user defined fields
$fields =& GetUserAccountFields();
foreach ($fields as $field) {
if ($field['on_create']) {
if ($field['required_create']) {
$v->Register($_REQUEST[$field['name']], V_EMPTY, sprintf($L['REQUIRED_FIELD'], $field['label']));
}
if (!IsEmptyString($_REQUEST[$field['name']]) && $field['validation']) {
$v->Register($_REQUEST[$field['name']], $field['validation'], $field['validation_message'], $field['validation_extras']);
}
}
}
// Download banner to check size
$banner_file = null;
if (!IsEmptyString($_REQUEST['banner_url']) && ($C['download_banners'] || $C['host_banners'])) {
$http = new Http();
if ($http->Get($_REQUEST['banner_url'], TRUE, $_REQUEST['site_url'])) {
$banner_file = SafeFilename("{$C['banner_dir']}/{$_REQUEST['username']}.jpg", FALSE);
FileWrite($banner_file, $http->body);
$banner_info = @getimagesize($banner_file);
if ($banner_info !== FALSE) {
$_REQUEST['banner_width'] = $banner_info[0];
$_REQUEST['banner_height'] = $banner_info[1];
if (filesize($banner_file) > $C['banner_max_bytes']) {
$v->SetError(sprintf($L['BAD_BANNER_BYTES'], $C['banner_max_bytes']));
}
//.........这里部分代码省略.........
示例4: HandlePreviewThumb
function HandlePreviewThumb(&$v, &$format, &$annotation)
{
global $L, $C, $domain;
list($width, $height) = explode('x', $format['preview_size']);
$imagefile = "{$GLOBALS['BASE_DIR']}/cache/" . md5(uniqid(rand(), true)) . ".jpg";
$i = GetImager();
switch ($_REQUEST['preview']) {
// Automatically crop and resize
case 'automatic':
$referrer_url = $_REQUEST['scan']['end_url'];
$preview_url = $_REQUEST['scan']['preview'];
if (!IsEmptyString($preview_url)) {
$http = new Http();
if ($http->Get($preview_url, TRUE, $referrer_url)) {
FileWrite($imagefile, $http->body);
$i->ResizeAuto($imagefile, $format['preview_size'], $annotation, $C['landscape_bias'], $C['portrait_bias']);
} else {
$v->SetError(sprintf($L['PREVIEW_DOWNLOAD_FAILED'], $http->errstr));
}
} else {
$v->SetError($L['NO_THUMBS_FOR_PREVIEW']);
}
break;
// Handle uploaded image
// Handle uploaded image
case 'upload':
if (is_uploaded_file($_FILES['upload']['tmp_name'])) {
move_uploaded_file($_FILES['upload']['tmp_name'], $imagefile);
@chmod($imagefile, 0666);
$image = @getimagesize($imagefile);
if ($image !== FALSE && $image[2] == IMAGETYPE_JPEG) {
// Image is properly sized
if ($image[0] == $width && $image[1] == $height) {
if ($C['have_imager']) {
$i->Annotate($imagefile, $annotation);
}
} else {
if ($C['have_imager'] && $C['handle_bad_size'] == 'crop') {
$i->ResizeAuto($imagefile, $format['preview_size'], $annotation, $C['landscape_bias'], $C['portrait_bias']);
} else {
@unlink($imagefile);
$v->SetError(sprintf($L['INVALID_IMAGE_SIZE'], $width, $height));
}
}
} else {
@unlink($imagefile);
$v->SetError($L['INVALID_IMAGE']);
}
} else {
$v->SetError($L['INVALID_UPLOAD']);
}
break;
// Cropping an image
// Cropping an image
case 'crop':
if (IsEmptyString($_REQUEST['scan']['preview'])) {
$v->SetError($L['NO_THUMBS_FOR_PREVIEW']);
}
$imagefile = null;
break;
// Cropping or no image provided
// Cropping or no image provided
default:
$imagefile = null;
break;
}
return $imagefile;
}
示例5: SimpleRss
function SimpleRss($sUrl, $vCacheTime = 300, $iNumItems = -1, $sInputEncoding = '', $sOutputEncoding = 'UTF-8')
{
$this->oRssObject = new RssObject();
// this object holds the returned data
$this->iNumItems = $iNumItems;
$this->sInputEncoding = $sInputEncoding;
$this->sOutputEncoding = $sOutputEncoding;
// make sure caching hasn't been disabled
if ($vCacheTime) {
$oCache = new PhpCache($sUrl . '_' . $this->iNumItems, $vCacheTime);
}
// is caching disabled or if not has the cache expired
if (!$vCacheTime || !$oCache->Check()) {
$oHttp = new Http();
// request feed
if ($sData = $oHttp->Get($sUrl)) {
$this->bSuccessful = $this->Parse($sData);
// do we want to cache result
if ($vCacheTime) {
$oCache->Set($this->oRssObject);
}
}
} else {
// get data from cache
$this->oRssObject = $oCache->Get();
$this->bSuccessful = true;
$this->bCached = true;
}
// check to see if request was successful, if not try and retrieve stale cache
if (!$this->bSuccessful && $vCacheTime && $oCache->Exists()) {
// make cache fresh
$oCache->ReValidate();
// get data from cache
$this->oRssObject = $oCache->Get();
$this->bSuccessful = true;
$this->bCached = true;
// mark as stale request
$this->bStaleCache = true;
}
}
示例6: txDownloadThumb
function txDownloadThumb()
{
global $DB, $json, $C;
$out = array('status' => JSON_FAILURE);
$id = md5($_REQUEST['thumb']);
$cachefile = SafeFilename("_{$_REQUEST['gallery_id']}_" . $id . ".jpg", FALSE);
if (!is_file("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}")) {
$http = new Http();
if ($http->Get($_REQUEST['thumb'], TRUE, $_REQUEST['gallery_url'])) {
FileWrite("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}", $http->body);
}
}
$out['size'] = @getimagesize("{$GLOBALS['BASE_DIR']}/cache/{$cachefile}");
if ($out['size'] !== FALSE) {
if ($out['size'][0] >= $C['min_thumb_width'] && $out['size'][1] >= $C['min_thumb_height'] && $out['size'][0] <= $C['max_thumb_width'] && $out['size'][1] <= $C['max_thumb_height']) {
$out['src'] = "{$C['install_url']}/cache/{$cachefile}";
$out['status'] = JSON_SUCCESS;
$out['id'] = $id;
} else {
$out['message'] = "Downloading " . htmlspecialchars($_REQUEST['thumb']) . " failed: image size of {$out['size'][0]}x{$out['size'][1]} is " . "not within the range of {$C['min_thumb_width']}x{$C['min_thumb_height']} to {$C['max_thumb_width']}x{$C['max_thumb_height']}";
}
} else {
$out['message'] = "Downloading " . htmlspecialchars($_REQUEST['thumb']) . " failed: not a valid image file";
}
echo $json->encode($out);
}
示例7: array
}
while ($account = $DB->NextRow($result)) {
$exception = 0x0;
$current_account++;
// Exit if stopped (pid set to 0)
$pid = $DB->Count('SELECT `pid` FROM `tlx_scanner_configs` WHERE `config_id`=?', array($config_id));
if ($pid == 0) {
break;
}
// Update scanner status
$DB->Update('UPDATE `tlx_scanner_configs` SET `current_status`=?,`status_updated`=? WHERE `config_id`=?', array("Scanning account {$current_account} of {$total_accounts}", time(), $config_id));
// Update history
$DB->Update('UPDATE `tlx_scanner_history` SET `scanned`=? WHERE `history_id`=?', array($current_account, $history_id));
// Check if the site URL is working
$http = new Http();
if ($http->Get($account['site_url'], $C['allow_redirect'])) {
$account['html'] = $http->body;
$account['headers'] = $http->raw_response_headers;
} else {
// Bad status code
if (!empty($http->response_headers['status'])) {
if (preg_match('~^3\\d\\d~', $http->response_headers['status'])) {
$exception = $exceptions['forward'];
} else {
$exception = $exceptions['broken'];
}
} else {
$exception = $exceptions['connect'];
}
}
$account['http'] =& $http;
示例8: apiData
/**
* 取接口数据
*
* @param string $this_api
*/
protected function apiData($this_api)
{
// 解析接口路径
$api = self::getApiInfo($this_api);
debugLog(__METHOD__ . '|api|' . $this_api, $api);
// 获取接口数据
$source_data = Http::Get($api['host'], $api['script'], $api['port']);
$source_data = empty($source_data) ? array() : json_decode($source_data, true);
debugLog(__METHOD__ . '|source data', $source_data);
return $source_data;
}
示例9: TestUrl
function TestUrl($url, $redirection)
{
if (!class_exists('http')) {
require_once "{$GLOBALS['BASE_DIR']}/includes/http.class.php";
}
$http = new Http();
$result = $http->Get($url, $redirection);
return array($result, $http->errstr);
}
示例10: foreach
} else {
@unlink($imagefile);
}
}
}
}
}
}
}
// Download thumbnail(s) from remote server
if ($configuration['process_downloadpreview']) {
foreach ($previews as $preview) {
if (!preg_match('~^' . $C['preview_url'] . '~', $preview['preview_url'])) {
$http = new Http();
// Download the image
if ($http->Get($preview['preview_url'], TRUE, $gallery['gallery_url'])) {
$imagefile = "{$GLOBALS['BASE_DIR']}/cache/" . md5(uniqid(rand(), true)) . ".jpg";
FileWrite($imagefile, $http->body);
$imagesize = @getimagesize($imagefile);
if ($imagesize !== FALSE && ($imagesize[2] = IMAGETYPE_JPEG)) {
$width = $imagesize[0];
$height = $imagesize[1];
$resized = FALSE;
// Resize thumb to specific size
if ($configuration['process_downloadresize'] && ($width != $preview_width || $height != $preview_height)) {
$imager->ResizeAuto($imagefile, $preview_width . 'x' . $preview_height, $annotation, $C['landscape_bias'], $C['portrait_bias']);
$width = $preview_width;
$height = $preview_height;
$resized = TRUE;
}
// Annotate the image
示例11: ImportFromRss
function ImportFromRss($feed)
{
global $DB, $C;
$settings = unserialize($feed['settings']);
$category = $DB->Row('SELECT * FROM `tx_categories` WHERE `category_id`=?', array($settings['category']));
$columns = $DB->GetColumns('tx_gallery_fields');
$imported = 0;
$defaults = array('gallery_url' => null, 'description' => null, 'keywords' => null, 'thumbnails' => 0, 'email' => $C['from_email'], 'nickname' => null, 'weight' => $C['gallery_weight'], 'clicks' => 0, 'submit_ip' => GetIpFromUrl($feed['feed_url']), 'gallery_ip' => '', 'sponsor_id' => !empty($feed['sponsor_id']) ? $feed['sponsor_id'] : null, 'type' => $settings['type'], 'format' => $settings['format'], 'status' => $settings['status'], 'previous_status' => null, 'date_scanned' => null, 'date_added' => MYSQL_NOW, 'date_approved' => null, 'date_scheduled' => null, 'date_displayed' => null, 'date_deletion' => null, 'partner' => null, 'administrator' => $_SERVER['REMOTE_USER'], 'admin_comments' => null, 'page_hash' => null, 'has_recip' => 0, 'has_preview' => 0, 'allow_scan' => 1, 'allow_preview' => 1, 'times_selected' => 0, 'used_counter' => 0, 'build_counter' => 0, 'tags' => null, 'categories' => MIXED_CATEGORY . " " . $category['tag'], 'preview_url' => null, 'dimensions' => null);
require_once "{$GLOBALS['BASE_DIR']}/includes/rssparser.class.php";
$http = new Http();
if ($http->Get($feed['feed_url'], TRUE, $C['install_url'])) {
$parser = new RSSParser();
if (($rss = $parser->Parse($http->body)) !== FALSE) {
foreach ($rss['items'] as $item) {
$gallery = array();
$gallery['gallery_url'] = html_entity_decode($item[$settings['gallery_url_from']]);
$gallery['description'] = html_entity_decode($item[$settings['description_from']]);
if (!empty($settings['date_added_from'])) {
if (($timestamp = strtotime($item[$settings['date_added_from']])) !== FALSE) {
$gallery['date_added'] = date(DF_DATETIME, $timestamp);
}
}
if (!empty($settings['preview_from'])) {
if (!is_array($item[$settings['preview_from']])) {
$item[$settings['preview_from']] = array($item[$settings['preview_from']]);
}
foreach ($item[$settings['preview_from']] as $item_value) {
if (preg_match('~(http://[^>< ]+\\.(jpg|png))~i', $item_value, $matches)) {
$gallery['preview_url'] = $matches[1];
break;
}
}
}
// Remove HTML tags and trim the description
$gallery['description'] = trim(strip_tags($gallery['description']));
// Merge with the defaults
$gallery = array_merge($defaults, $gallery);
// Skip over duplicate or empty URLs
if ($DB->Count('SELECT COUNT(*) FROM `tx_galleries` WHERE `gallery_url`=?', array($gallery['gallery_url'])) || IsEmptyString($gallery['gallery_url'])) {
continue;
}
$imported++;
// Has a preview thumbnail
if (!empty($gallery['preview_url'])) {
$gallery['has_preview'] = 1;
}
// Add regular fields
$DB->Update('INSERT INTO `tx_galleries` VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', array(null, $gallery['gallery_url'], $gallery['description'], $gallery['keywords'], $gallery['thumbnails'], $gallery['email'], $gallery['nickname'], $gallery['weight'], $gallery['clicks'], $gallery['submit_ip'], $gallery['gallery_ip'], $gallery['sponsor_id'], $gallery['type'], $gallery['format'], $gallery['status'], $gallery['previous_status'], $gallery['date_scanned'], $gallery['date_added'], $gallery['date_approved'], $gallery['date_scheduled'], $gallery['date_displayed'], $gallery['date_deletion'], $gallery['partner'], $gallery['administrator'], $gallery['admin_comments'], $gallery['page_hash'], $gallery['has_recip'], $gallery['has_preview'], $gallery['allow_scan'], $gallery['allow_preview'], $gallery['times_selected'], $gallery['used_counter'], $gallery['build_counter'], $gallery['tags'], $gallery['categories']));
$gallery['gallery_id'] = $DB->InsertID();
// Add user defined fields
$query_data = CreateUserInsert('tx_gallery_fields', $gallery, $columns);
$DB->Update('INSERT INTO `tx_gallery_fields` VALUES (' . $query_data['bind_list'] . ')', $query_data['binds']);
// Has a preview thumbnail
if (!empty($gallery['preview_url'])) {
$DB->Update('INSERT INTO `tx_gallery_previews` VALUES (?,?,?,?)', array(null, $gallery['gallery_id'], $gallery['preview_url'], $gallery['dimensions']));
}
}
}
$DB->Update('UPDATE `tx_rss_feeds` SET `date_last_import`=? WHERE `feed_id`=?', array(MYSQL_NOW, $feed['feed_id']));
} else {
return "Could not access the RSS feed: " . $http->errstr;
}
return $imported;
}
示例12: sysMsg
/**
* 发站内消息接口
* @param string $toid
* @param string $content
* @param string $from
*/
public static function sysMsg($toid, $content, $from = false)
{
if (!$toid) {
return null;
}
if (!$from) {
$from = 'cs';
}
$key = md5('msg_no_ip_ban');
$page = "api/sendsys.php?from={$from}&to={$toid}&content=" . urlencode("{$content}") . ($key ? '&key=' . $key : '');
$return = Http::Get('msg.56.com', $page);
return $return;
}
示例13: array
function &ScanLink(&$link)
{
global $DB, $C, $L;
$result = array('has_recip' => 0, 'site_url' => array(), 'recip_url' => null);
if (!class_exists('http')) {
require_once "{$GLOBALS['BASE_DIR']}/includes/http.class.php";
}
$http = new Http();
// Check site URL
$result['site_url']['working'] = $http->Get($link['site_url'], $link['allow_redirect']);
$result['site_url']['error'] = $http->errstr;
$result['site_url']['status'] = $http->response_headers['status'];
$result['site_url']['ip_address'] = IPFromUrl($link['site_url']);
$result['site_url']['html'] = $http->body;
$result['site_url']['has_recip'] = HasReciprocal($http->body);
// Check recip URL, if provided
if ($link['recip_url']) {
$http = new Http();
$result['recip_url'] = array();
$result['recip_url']['working'] = $http->Get($link['recip_url'], $link['allow_redirect']);
$result['recip_url']['error'] = $http->errstr;
$result['recip_url']['status'] = $http->response_headers['status'];
$result['recip_url']['ip_address'] = IPFromUrl($link['recip_url']);
$result['recip_url']['html'] = $http->body;
$result['recip_url']['has_recip'] = HasReciprocal($http->body);
}
$result['has_recip'] = $result['site_url']['has_recip'] || $result['recip_url']['has_recip'];
return $result;
}
示例14: GetProfile2011
/**
* @name GetProfile
* @author zhys9
* @desc ȡû
* @param string $user_id
* @param bool $big_photo
* @param int $short 0|1 1ֻҪϢ0ȫϢ
* @return array
*
* @ijֶ֧û
* @modify Melon`` 2010
一个或者多个用户名取得用户信息,请求一次用户接口
*/
public static function GetProfile2011($user_id, $big_photo = true, $short = 0)
{
$root_uri = self::API_ROOT . '?short=' . $short . '&charset=' . self::$charset . '&user_id=';
$uri = $root_uri . $user_id;
//if(DEBUG) _debug("CallUserApi: $uri");
//send request
$rs = Http::Get(self::API_HOST, $uri, self::API_PORT);
if ($rs) {
$info = array();
if (strpos($user_id, ',') == TRUE) {
$rs = unserialize($rs);
if (is_array($rs)) {
foreach ($rs as $k => &$v) {
$v['nickname'] = $v['LastName'] ? $v['LastName'] : $v['Account'];
unset($rs[$k]['LastName']);
$v['photo'] = self::GetPhotoUrl($v['Account'], $big_photo, $v['head']);
}
}
$info = $rs;
} else {
@parse_str($rs, $info);
$nickname = $info['LastName'];
unset($info['LastName']);
$info['nickname'] = $nickname ? $nickname : $info['Account'];
$info['photo'] = self::GetPhotoUrl($user_id, $big_photo, $info['head']);
}
return $info;
} else {
return array();
}
}
示例15: txCropWithBias
function txCropWithBias()
{
global $DB, $C;
require_once "{$GLOBALS['BASE_DIR']}/includes/imager.class.php";
$gallery = $DB->Row('SELECT * FROM `tx_galleries` WHERE `gallery_id`=?', array($_REQUEST['gallery_id']));
$categories =& CategoriesFromTags($gallery['categories']);
$format = GetCategoryFormat($gallery['format'], $categories[0]);
$annotation =& LoadAnnotation($format['annotation'], $categories[0]['name']);
$tempfile = md5(uniqid(rand(), true)) . ".jpg";
$http = new Http();
if ($http->Get($_REQUEST['imagefile'], TRUE, $gallery['gallery_url'])) {
FileWrite("{$GLOBALS['BASE_DIR']}/cache/{$tempfile}", $http->body);
$i = GetImager();
$i->ResizeAuto("{$GLOBALS['BASE_DIR']}/cache/{$tempfile}", $_REQUEST['dimensions'], $annotation, $_REQUEST['bias_land'], $_REQUEST['bias_port']);
$preview = AddPreview($gallery['gallery_id'], $_REQUEST['dimensions'], "{$GLOBALS['BASE_DIR']}/cache/{$tempfile}");
UpdateThumbSizes($_REQUEST['dimensions']);
include_once 'includes/crop-complete.php';
} else {
$error = 'Could not download image file: ' . $http->errstr;
include_once 'includes/error.php';
}
}