当前位置: 首页>>代码示例>>PHP>>正文


PHP utils::file_get_contents_curl方法代码示例

本文整理汇总了PHP中utils::file_get_contents_curl方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::file_get_contents_curl方法的具体用法?PHP utils::file_get_contents_curl怎么用?PHP utils::file_get_contents_curl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils的用法示例。


在下文中一共展示了utils::file_get_contents_curl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPublishedPatchs

 /**
  * Used to get the published patches of a given server and a given pushfeed
  * (and optionnaly a page title)
  * @param <string> $server url of the server
  * @param <string> $pushName pushfeed name
  * @param <string> $title article title
  * @return <array> array of patchIDs
  */
 static function getPublishedPatchs($server, $pushName, $title = null)
 {
     //global $wgScriptExtension;
     $published = array();
     $pushName = str_replace(' ', '_', $pushName);
     $title = str_replace(' ', '_', $title);
     if (isset($title)) {
         $patchXML = utils::file_get_contents_curl(utils::lcfirst($server) . "/api.php?action=query&meta=patchPushed&pppushName=" . $pushName . '&pppageName=' . $title . '&format=xml');
         /*test if it is a xml file. If not, the server is not reachable via the url
          * Then we try to reach it with the .php5 extension
          */
         if (strpos($patchXML, "<?xml version=\"1.0\"?>") === false) {
             $patchXML = utils::file_get_contents_curl(utils::lcfirst($server) . "/api.php5?action=query&meta=patchPushed&pppushName=" . $pushName . '&pppageName=' . $title . '&format=xml');
         }
         if (strpos($patchXML, "<?xml version=\"1.0\"?>") === false) {
             $patchXML = false;
         }
     } else {
         $patchXML = utils::file_get_contents_curl(utils::lcfirst($server) . "/api.php?action=query&meta=patchPushed&pppushName=" . $pushName . '&format=xml');
         /*test if it is a xml file. If not, the server is not reachable via the url
          * Then we try to reach it with the .php5 extension
          */
         if (strpos($patchXML, "<?xml version=\"1.0\"?>") === false) {
             $patchXML = utils::file_get_contents_curl(utils::lcfirst($server) . "/api.php5?action=query&meta=patchPushed&pppushName=" . $pushName . '&format=xml');
         }
         if (strpos($patchXML, "<?xml version=\"1.0\"?>") === false) {
             $patchXML = false;
         }
     }
     if ($patchXML === false) {
         return false;
     }
     $patchXML = trim($patchXML);
     $dom = new DOMDocument();
     $dom->loadXML($patchXML);
     $patchPublished = $dom->getElementsByTagName('patch');
     $published = array();
     foreach ($patchPublished as $p) {
         $published[] = $p->firstChild->nodeValue;
     }
     return $published;
 }
开发者ID:hala54,项目名称:DSMW,代码行数:50,代码来源:utils.php

示例2: onUnknownAction


//.........这里部分代码省略.........
         }
         // $name = $name1[0];//with NS
         utils::writeAndFlush('<p><b>Start pull</b></p>');
         foreach ($name1 as $name) {
             // for each pullfeed name==> pull
             utils::writeAndFlush("<span style=\"margin-left:30px;\">begin pull: <A HREF=" . 'http://' . $wgServerName . $wgScriptPath . "/index.php?title={$name}>" . $name . "</a></span> <br/>");
             wfDebugLog('p2p', '      -> pull : ' . $name);
             // $previousCSID = getPreviousPulledCSID($name);
             // if($previousCSID==false) {
             //	$previousCSID = "none";
             // }
             $previousCSID = getHasPullHead($name);
             if ($previousCSID == false) {
                 $previousCSID = "none";
             }
             wfDebugLog('p2p', '      -> pullHead : ' . $previousCSID);
             $relatedPushServer = getPushURL($name);
             if (is_null($relatedPushServer)) {
                 throw new MWException(__METHOD__ . ': no relatedPushServer url');
             }
             $namePush = getPushName($name);
             $namePush = str_replace(' ', '_', $namePush);
             wfDebugLog('p2p', '      -> pushServer : ' . $relatedPushServer);
             wfDebugLog('p2p', '      -> pushName : ' . $namePush);
             if (is_null($namePush)) {
                 throw new MWException(__METHOD__ . ': no PushName');
             }
             // split NS and name
             preg_match("/^(.+?)_*:_*(.*)\$/S", $namePush, $m);
             $nameWithoutNS = $m[2];
             // $url = $relatedPushServer.'/api.php?action=query&meta=changeSet&cspushName='.$nameWithoutNS.'&cschangeSet='.$previousCSID.'&format=xml';
             // $url = $relatedPushServer."/api{$wgScriptExtension}?action=query&meta=changeSet&cspushName=".$nameWithoutNS.'&cschangeSet='.$previousCSID.'&format=xml';
             wfDebugLog('testlog', '      -> request ChangeSet : ' . $relatedPushServer . '/api.php?action=query&meta=changeSet&cspushName=' . $nameWithoutNS . '&cschangeSet=' . $previousCSID . '&format=xml');
             $cs = utils::file_get_contents_curl(utils::lcfirst($relatedPushServer) . "/api.php?action=query&meta=changeSet&cspushName=" . $nameWithoutNS . '&cschangeSet=' . $previousCSID . '&format=xml');
             /* test if it is a xml file. If not, the server is not reachable via the url
              * Then we try to reach it with the .php5 extension
              */
             if (strpos($cs, "<?xml version=\"1.0\"?>") === false) {
                 $cs = utils::file_get_contents_curl(utils::lcfirst($relatedPushServer) . "/api.php5?action=query&meta=changeSet&cspushName=" . $nameWithoutNS . '&cschangeSet=' . $previousCSID . '&format=xml');
             }
             if (strpos($cs, "<?xml version=\"1.0\"?>") === false) {
                 $cs = false;
             }
             if ($cs === false) {
                 throw new MWException(__METHOD__ . ': Cannot connect to Push Server (ChangeSet API)');
             }
             $cs = trim($cs);
             $dom = new DOMDocument();
             $dom->loadXML($cs);
             $changeSet = $dom->getElementsByTagName('changeSet');
             $CSID = null;
             foreach ($changeSet as $cs) {
                 if ($cs->hasAttribute("id")) {
                     $CSID = $cs->getAttribute('id');
                     $csName = $CSID;
                 }
             }
             wfDebugLog('p2p', '     -> changeSet found ' . $CSID);
             while ($CSID != null) {
                 // if(!utils::pageExist($CSID)) {
                 $listPatch = null;
                 $patchs = $dom->getElementsByTagName('patch');
                 foreach ($patchs as $p) {
                     wfDebugLog('p2p', '          -> patch ' . $p->firstChild->nodeValue);
                     $listPatch[] = $p->firstChild->nodeValue;
                 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:67,代码来源:DSMW.hooks.php

示例3: downloadFile

function downloadFile($url)
{
    global $wgServerName, $wgServer, $wgContLang, $wgAuth, $wgScriptPath, $wgScriptExtension, $wgMemc, $wgRequest;
    $apiUrl = $wgServer . $wgScriptPath . "/api" . $wgScriptExtension;
    $edittoken = $apiUrl . "?action=query&prop=info&intoken=edit&titles=Foo&format=xml";
    $edittoken = utils::file_get_contents_curl($edittoken);
    $dom = new DOMDocument();
    $dom->loadXML($edittoken);
    $edittoken = $dom->getElementsByTagName('page');
    foreach ($edittoken as $p) {
        if ($p->hasAttribute("edittoken")) {
            $token = $p->getAttribute('edittoken');
        }
    }
    $token = str_replace("+", "%2B", $token);
    //    $url = $patch->getUrl();
    $onPage = preg_split("/^.*\\//", $url);
    $onPage = $onPage[1];
    $onPage = str_replace(array(' '), array('_'), $onPage);
    $url = str_replace(array(':', 'Http', ' '), array('%3A', 'http', '_'), $url);
    $download = $apiUrl . "?action=upload&filename=" . $onPage . "&url=" . $url . "&token=" . $token . "&ignorewarnings=1";
    $resp = Http::post($download);
    libxml_use_internal_errors(true);
    $sxe = simplexml_load_string($resp);
}
开发者ID:hala54,项目名称:DSMW,代码行数:25,代码来源:IntegrationFunctions.php


注:本文中的utils::file_get_contents_curl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。