Ejemplo n.º 1
0
    public static function generateView($name, $head)
    {
        echo "<!--\n";
        $objects = isset($_COOKIE['timeeditobjects']) && $_COOKIE['timeeditobjects'] != '' ? explode(',', $_COOKIE['timeeditobjects']) : array();
        $objStr = "wv_obj1={$objects['0']}";
        $objNum = count($objects);
        for ($i = 1; $i < $objNum; $i++) {
            $thisNum = $i + 1;
            $objStr .= "&wv_obj{$thisNum}={$objects[$i]}";
        }
        $url = "http://schema.angstrom.uu.se/4DACTION/WebShowSearchPrint/2/1?" . "wv_text=text&{$objStr}";
        //echo "---$url---\n";
        $timeeditHTML = @getRemoteFile($url);
        $viewXML = '';
        if ($timeeditHTML !== '') {
            $calXML = self::transform($timeeditHTML, MODULE_DIR . 'timeedit/calendar.xsl');
            $calDoc = new DOMDocument();
            $calDoc->loadXML($calXML);
            // augment DOM Document
            self::augmentViewDOM($calDoc, $name, $head);
            $viewXML = $calDoc->saveXML();
            $viewXML = str_replace('<?xml version="1.0"?' . '>', '', $viewXML);
        } else {
            $viewXML = <<<XML
<calendar>
  <error>
    Det uppstod ett fel, försök gärna igen om en liten stund.
  </error>
</calendar>
XML;
        }
        echo "-->\n";
        return $viewXML;
    }
Ejemplo n.º 2
0
 function Read($url)
 {
     $this->FeedArray = array();
     $json = getRemoteFile($url);
     $json_output = json_decode($json);
     $this->g_id = $json_output->id;
     $this->g_name = $json_output->name;
     $this->g_pic = $json_output->picture;
     $this->g_link = $json_output->link;
     //fill with header info
     $h_array = array("type" => 0, "title" => $this->g_name, "link" => $this->g_link, "description" => "", "updated" => "");
     array_push($this->FeedArray, $h_array);
     //get feed
     $feed_url = $url . "/feed";
     //read feed
     $this->Read_feed($feed_url);
     //var_dump($this->FeedArray);
     return $this->FeedArray;
 }
function smarty_function_get_remote($params, &$smarty)
{   
    // Default options
    $opts = array(
        'default' => 'Not found',
        'fix' => 'src|href|action'
        );
    $opts = array_merge($opts, $params);
    
    // Make sure they passed a source url
    if (isset($opts['url']))
    {
        $opts['url'] = $opts['url'];
    }
    else
    {      
        die($opts['default']);
    }
    
    // Retrieve the remote file
    $content = @getRemoteFile($opts);
    
    // Make sure we actually got something
    if (!$content) die ($opts['default']);
    
    // Fix relative urls to point to the old site
    if ($opts['fix'])
    {
        $opts['patterns'][] = '/('.$opts['fix'].')=[\'"]([^(?:http)|\/].*)[\'"]/ie';
		    $opts['replacements'][] = '"${1}=\'".$domain."/".getAbsolutePath($base_url."/${2}")."\'"';
        $opts['patterns'][] = '/('.$opts['fix'].')=[\'"](\/.*)[\'"]/ie';
		    $opts['replacements'][] = '"${1}=\'".$domain."${2}\'"';
    }
    $content = fixUrls($content, $opts);
    
    // Output the contents to the template
    return $content;
}
 function pingGeoURL($blog_ID = 1)
 {
     $ourUrl = get_settings('blodotgsping_url') . "/index.php?p=" . $blog_ID;
     $host = "geourl.org";
     $path = "/ping/?p=" . $ourUrl;
     getRemoteFile($host, $path);
 }
function pingGeoURL($blog_ID)
{
    global $blodotgsping_url;
    $ourUrl = $blodotgsping_url . "/index.php?p=" . $blog_ID;
    $host = "geourl.org";
    $path = "/ping/?p=" . $ourUrl;
    getRemoteFile($host, $path);
}
    }
    // Return result
    return $strResult;
}
if (substr($strPiwikURL, -1, 1) != '/' && substr($strPiwikURL, -10, 10) != '/index.php') {
    $strPiwikURL .= '/';
}
$aryURLs = array();
$aryURLs['SitesManager.getSitesWithAtLeastViewAccess'] = $strPiwikURL . '?module=API&method=SitesManager.getSitesWithAtLeastViewAccess&format=XML';
$aryURLs['SitesManager.getSitesIdFromSiteUrl'] = $strPiwikURL . '?module=API&method=SitesManager.getSitesIdFromSiteUrl&url=' . urlencode($strPiwikYourBlogURL) . '&format=XML';
$strToken = '&token_auth=' . $strPiwikAuthToken;
$intTest = 0;
?>
<textarea readonly="readonly" rows="13" cols="100">
<?php 
foreach ($aryURLs as $strMethod => $strURL) {
    $intTest++;
    echo '*** Test ' . $intTest . '/' . count($aryURLs) . ': ' . $strMethod . ' ***' . "\n";
    echo 'Using: ' . (function_exists('curl_init') ? 'cURL' : 'fopen') . "\n";
    echo 'SSL peer verification: ' . (function_exists('curl_init') && !$bolDisableSSLVer ? 'enabled' : 'disabled') . "\n";
    echo 'User Agent: ' . $strUA . "\n";
    echo 'Call: ' . $strURL . '&token_auth= + TOKEN' . "\n";
    $x = microtime(true);
    $strResult = getRemoteFile($strURL, $strToken, !$bolDisableSSLVer, $strUA);
    $x = microtime(true) - $x;
    echo 'Result:' . "\n";
    echo htmlentities($strResult) . "\n";
    echo 'Time: ' . round($x, 2) . 's' . ($intTest < count($aryURLs) ? "\n\n" : '');
}
?>
</textarea>
Ejemplo n.º 7
0
//echo $result['ResultList']['Item']['Result'];
//echo $result['ResultList']['Item']['Status'];
//echo $result['ResultList']['Item']['DesFile'];
echo '网络图片识别开始:';
echo '<br /><br />识别状态:' . ($result['ResultList']['Item']['Status'] ? '成功' : '失败');
if ($result['ResultList']['Item']['Status'] == 'true') {
    echo '<br /><br />原始图片: <br /><br /><img src="' . $result['ResultList']['Item']['SrcFile'] . '">';
    echo '<br /><br />处理后的图片是: <br /><br /><img src="' . $result['ResultList']['Item']['DesFile'] . '">';
    echo '<br /><br />识别的结果是:' . $result['ResultList']['Item']['Result'];
}
//以下为识别本地验证码图片过程
//如验证码图片的原始地址  https://www.bestpay.com.cn/api/captcha/getCode?1408294248050
//识别参数请根据上面的进行修改
$var = array('language' => 'eng', 'service' => 'OcrKingForCaptcha', 'charset' => 7, 'gbk' => true, 'type' => 'https://www.bestpay.com.cn/api/captcha/getCode?1408294248050');
//保存验证码图片到本地,同时保存对应的cookie
$down = getRemoteFile('https://www.bestpay.com.cn/api/captcha/getCode?1408294248050', '.png');
//实例化OcrKing识别
$ocrking = new OcrKing(API_KEY);
//上传图片识别 请在doOcrKing方法前调用
$ocrking->setFilePath($down['imagepath']);
//提交识别
$ocrking->doOcrKing($var);
//检查识别状态
if (!$ocrking->getStatus()) {
    die($ocrking->getError());
}
//获取识别结果
$result = $ocrking->getResult();
//原始结果 xml格式,一般用于出错时调试
//echo $ocrking->getRawResult();
//打印识别结果数组
Ejemplo n.º 8
0
function contactWebService($webServiceURL)
{
    $failed = TRUE;
    $response = "";
    if (function_exists('curl_init')) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $webServiceURL);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_USERAGENT, "YAACC/" . YAACC_VERSION);
        curl_setopt($ch, CURLOPT_REFERER, "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
        $response = curl_exec($ch);
        curl_close($ch);
        $failed = $response === FALSE;
    } else {
        $url = $webServiceURL . "&ref=" . urlencode($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
        $response = getRemoteFile($url);
        $failed = empty($response);
    }
    if ($failed) {
        if (ini_get('allow_url_fopen') == '1') {
            $url = $webServiceURL . "&ver=" . YAACC_VERSION . "&ref=" . urlencode($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
            if ($fp = @fopen($url, 'r')) {
                while ($line = fread($fp, 1024)) {
                    $response .= $line;
                }
            } else {
                $response = @file_get_contents($url);
                $failed = $response === false;
            }
        }
    }
    return $response;
}
Ejemplo n.º 9
0
 /**
  *  Get the data out of a feed 
  *  - Input: the URL of the feed
  *  - Output: a two-dimensional array holding the data  
  */
 function Universal_Reader($url)
 {
     // global $Universal_FeedArray;
     // global $Universal_Content;
     // global $Universal_Style;
     // global $Universal_Date_Font;
     // global $Universal_AtomChannelTags;
     // global $Universal_RssChannelTags;
     // global $Universal_AtomItemTags;
     // global $Universal_RssItemTags;
     // global $Universal_Doc;
     $this->Universal_FeedArray = array();
     $this->Universal_Doc = new DOMDocument("1.0");
     $test = getRemoteFile($url);
     @$this->Universal_Doc->loadXML($test);
     //var_dump($this->Universal_Doc);
     $this->Universal_Content = array();
     $channel = $this->extractChannel("feed");
     $isAtom = $channel != false;
     if ($isAtom) {
         $channelArray = $this->getTags($channel, $this->Universal_AtomChannelTags, 0);
         $items = $this->extractItems($channel, "entry");
         $tagSchema = $this->Universal_AtomItemTags;
     } else {
         $channel = $this->extractChannel("channel");
         if ($channel == null) {
             $a = array();
             $a[0]['title'] = "Error";
             $a[0]['description'] = "Server unreachable";
             $a[1]['title'] = "Error";
             $a[1]['description'] = "Server unreachable";
             return $a;
         }
         $channelArray = $this->getTags($channel, $this->Universal_RssChannelTags, 0);
         $items = $this->extractItems($channel, "item");
         $tagSchema = $this->Universal_RssItemTags;
     }
     array_push($this->Universal_FeedArray, $channelArray);
     foreach ($items as $item) {
         array_push($this->Universal_FeedArray, $this->getTags($item, $tagSchema, 1));
     }
     //var_dump($this->Universal_FeedArray);
     return $this->Universal_FeedArray;
 }
Ejemplo n.º 10
0
    }
    // Return result
    return $strResult;
}
if (substr($strPiwikURL, -1, 1) != '/' && substr($strPiwikURL, -10, 10) != '/index.php') {
    $strPiwikURL .= '/';
}
$aryURLs = array();
$aryURLs['SitesManager.getSitesWithAtLeastViewAccess'] = $strPiwikURL . '?module=API&method=SitesManager.getSitesWithAtLeastViewAccess&format=XML';
$aryURLs['SitesManager.getSitesIdFromSiteUrl'] = $strPiwikURL . '?module=API&method=SitesManager.getSitesIdFromSiteUrl&url=' . urlencode($strPiwikYourBlogURL) . '&format=XML';
$strToken = '&token_auth=' . $strPiwikAuthToken;
$intTest = 0;
?>
<textarea readonly="readonly" rows="13" cols="100">
<?php 
foreach ($aryURLs as $strMethod => $strURL) {
    $intTest++;
    echo '*** Test ' . $intTest . '/' . count($aryURLs) . ': ' . $strMethod . ' ***' . "\n";
    echo 'Using: ' . (function_exists('curl_init') ? 'cURL' : 'fopen') . "\n";
    echo 'SSL peer verification: ' . (function_exists('curl_init') && !self::$aryGlobalSettings['disable_ssl_verify'] ? 'enabled' : 'disabled') . "\n";
    echo 'User Agent: ' . $strUA . "\n";
    echo 'Call: ' . $strURL . '&token_auth= + TOKEN' . "\n";
    $x = microtime(true);
    $strResult = getRemoteFile($strURL, $strToken, !self::$aryGlobalSettings['disable_ssl_verify'], $strUA);
    $x = microtime(true) - $x;
    echo 'Result:' . "\n";
    echo htmlentities($strResult) . "\n";
    echo 'Time: ' . round($x, 2) . 's' . ($intTest < count($aryURLs) ? "\n\n" : '');
}
?>
</textarea>
//echo $result['ResultList']['Item']['Result'];
//echo $result['ResultList']['Item']['Status'];
//echo $result['ResultList']['Item']['DesFile'];
echo '网络图片识别开始:';
echo '<br /><br />识别状态:' . ($result['ResultList']['Item']['Status'] ? '成功' : '失败');
if ($result['ResultList']['Item']['Status'] == 'true') {
    echo '<br /><br />原始图片: <br /><br /><img src="' . $result['ResultList']['Item']['SrcFile'] . '">';
    echo '<br /><br />处理后的图片是: <br /><br /><img src="' . $result['ResultList']['Item']['DesFile'] . '">';
    echo '<br /><br />识别的结果是:' . $result['ResultList']['Item']['Result'];
}
//以下为识别本地验证码图片过程
//如验证码图片的原始地址  https://www.bestpay.com.cn/api/captcha/getCode?1408294248050
//识别参数请根据上面的进行修改
$var = array('language' => 'eng', 'service' => 'BarcodeDecode', 'charset' => 1, 'gbk' => true, 'type' => 'http://www.unknown.com');
//保存验证码图片到本地,同时保存对应的cookie
$down = getRemoteFile('http://127.0.0.1/9/UsePhotoDistinguishQRCode/qrcode2', '.png');
//实例化OcrKing识别
$ocrking = new OcrKing(API_KEY);
//上传图片识别 请在doOcrKing方法前调用
$ocrking->setFilePath($down['imagepath']);
//提交识别
$ocrking->doOcrKing($var);
//检查识别状态
if (!$ocrking->getStatus()) {
    die($ocrking->getError());
}
//获取识别结果
$result = $ocrking->getResult();
//原始结果 xml格式,一般用于出错时调试
//echo $ocrking->getRawResult();
//打印识别结果数组