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


PHP fputs函数代码示例

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


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

示例1: setUp

    public function setUp()
    {
        $base = 'lithium\\net\\socket';
        $namespace = __NAMESPACE__;
        Mocker::overwriteFunction("{$namespace}\\stream_context_get_options", function ($resource) {
            rewind($resource);
            return unserialize(stream_get_contents($resource));
        });
        Mocker::overwriteFunction("{$base}\\stream_context_create", function ($options) {
            return $options;
        });
        Mocker::overwriteFunction("{$base}\\fopen", function ($file, $mode, $includePath, $context) {
            $handle = fopen("php://memory", "rw");
            fputs($handle, serialize($context));
            return $handle;
        });
        Mocker::overwriteFunction("{$base}\\stream_get_meta_data", function ($resource) {
            return array('wrapper_data' => array('HTTP/1.1 301 Moved Permanently', 'Location: http://www.google.com/', 'Content-Type: text/html; charset=UTF-8', 'Date: Thu, 28 Feb 2013 07:05:10 GMT', 'Expires: Sat, 30 Mar 2013 07:05:10 GMT', 'Cache-Control: public, max-age=2592000', 'Server: gws', 'Content-Length: 219', 'X-XSS-Protection: 1; mode=block', 'X-Frame-Options: SAMEORIGIN', 'Connection: close'));
        });
        Mocker::overwriteFunction("{$base}\\stream_get_contents", function ($resource) {
            return <<<EOD
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
EOD;
        });
        Mocker::overwriteFunction("{$base}\\feof", function ($resource) {
            return true;
        });
    }
开发者ID:nilamdoc,项目名称:KYCGlobal,代码行数:33,代码来源:ContextTest.php

示例2: slog

function slog($logs)
{
    $toppath = $_SERVER["DOCUMENT_ROOT"] . "/log.htm";
    $Ts = fopen($toppath, "a+");
    fputs($Ts, $logs . "\r\n");
    fclose($Ts);
}
开发者ID:liuguogen,项目名称:weixin,代码行数:7,代码来源:safe3.php

示例3: verify_notify

 /**
  *    返回通知结果
  *
  *    @author    Garbin
  *    @param     array $order_info
  *    @param     bool  $strict
  *    @return    array
  */
 function verify_notify($order_info, $strict = false)
 {
     if (empty($order_info)) {
         $this->_error('order_info_empty');
         return false;
     }
     $merchant_id = $this->_config['paypal_account'];
     $req = 'cmd=_notify-validate';
     foreach ($_POST as $key => $value) {
         $value = urlencode(stripslashes($value));
         $req .= "&{$key}={$value}";
     }
     $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
     $fp = fsockopen('www.sandbox.paypal.com', 80, $errno, $errstr, 30);
     $item_name = $_POST['item_name'];
     $item_number = $_POST['item_number'];
     $payment_status = $_POST['payment_status'];
     $payment_amount = $_POST['mc_gross'];
     $payment_currency = $_POST['mc_currency'];
     $txn_id = $_POST['txn_id'];
     $receiver_email = $_POST['receiver_email'];
     $payer_email = $_POST['payer_email'];
     $order_sn = $_POST['invoice'];
     $memo = empty($_POST['memo']) ? '' : $_POST['memo'];
     if (!$fp) {
         fclose($fp);
         return false;
     } else {
         fputs($fp, $header . $req);
         while (!feof($fp)) {
             $res = fgets($fp, 1024);
             if (strcmp($res, 'VERIFIED') == 0) {
                 if ($payment_status != 'Completed' && $payment_status != 'Pending') {
                     fclose($fp);
                     return false;
                 }
                 if ($receiver_email != $merchant_id) {
                     fclose($fp);
                     return false;
                 }
                 if ($order_info['order_amount'] != $payment_amount) {
                     fclose($fp);
                     $this->_error('money_inequalit');
                     return false;
                 }
                 if ($this->_config['paypal_currency'] != $payment_currency) {
                     fclose($fp);
                     return false;
                 }
                 fclose($fp);
                 return array('target' => ORDER_ACCEPTED);
             } elseif (strcmp($res, 'INVALID') == 0) {
                 fclose($fp);
                 return false;
             }
         }
     }
 }
开发者ID:BGCX261,项目名称:zhou3liu-svn-to-git,代码行数:68,代码来源:paypal.payment.php

示例4: SendMail

 function SendMail()
 {
     if ($SMTPIN = fsockopen($this->SmtpServer, $this->PortSMTP)) {
         fputs($SMTPIN, "EHLO " . $HTTP_HOST . "\r\n");
         $talk["hello"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, "auth login\r\n");
         $talk["res"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, $this->SmtpUser . "\r\n");
         $talk["user"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, $this->SmtpPass . "\r\n");
         $talk["pass"] = fgets($SMTPIN, 256);
         fputs($SMTPIN, "MAIL FROM: <" . $this->from . ">\r\n");
         $talk["From"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, "RCPT TO: <" . $this->to . ">\r\n");
         $talk["To"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, "DATA\r\n");
         $talk["data"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, "To: <" . $this->to . ">\r\nFrom: <" . $this->from . ">\r\nSubject:" . $this->subject . "\r\n\r\n\r\n" . $this->body . "\r\n.\r\n");
         $talk["send"] = fgets($SMTPIN, 256);
         //CLOSE CONNECTION AND EXIT ...
         fputs($SMTPIN, "QUIT\r\n");
         fclose($SMTPIN);
         //
     }
     return $talk;
 }
开发者ID:xhsui,项目名称:ci_system,代码行数:26,代码来源:SMTPClass.php

示例5: openstats

 function openstats()
 {
     $fp = fsockopen($this->host, $this->port, $errno, $errstr, 10);
     if (!$fp) {
         $this->_error = "{$errstr} ({$errno})";
         return 0;
     } else {
         fputs($fp, "GET /admin.cgi?pass=" . $this->passwd . "&mode=viewxml HTTP/1.0\r\n");
         fputs($fp, "User-Agent: Mozilla\r\n\r\n");
         while (!feof($fp)) {
             $this->_xml .= fgets($fp, 512);
         }
         fclose($fp);
         if (stristr($this->_xml, "HTTP/1.0 200 OK") == true) {
             // <-H> Thanks to Blaster for this fix.. trim();
             $this->_xml = trim(substr($this->_xml, 42));
         } else {
             $this->_error = "Bad login";
             return 0;
         }
         $xmlparser = xml_parser_create();
         if (!xml_parse_into_struct($xmlparser, $this->_xml, $this->_values, $this->_indexes)) {
             $this->_error = "Unparsable XML";
             return 0;
         }
         xml_parser_free($xmlparser);
         return 1;
     }
 }
开发者ID:Karpec,项目名称:gizd,代码行数:29,代码来源:shoutcast.class.php

示例6: wl

function wl($the_string)
{
    $fi = fopen('logfile2.txt', 'a+');
    $the_string = $the_string . "\n";
    fputs($fi, $the_string, strlen($the_string));
    fclose($fi);
}
开发者ID:hastapasta,项目名称:financereport,代码行数:7,代码来源:functions.php

示例7: send_mail

 public function send_mail()
 {
     $talk = array();
     if ($SMTPIN = fsockopen($this->SmtpServer, $this->PortSMTP)) {
         fputs($SMTPIN, "EHLO " . $HTTP_HOST . "\r\n");
         $talk["hello"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, "auth login\r\n");
         $talk["res"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, $this->SmtpUser . "\r\n");
         $talk["user"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, $this->SmtpPass . "\r\n");
         $talk["pass"] = fgets($SMTPIN, 256);
         fputs($SMTPIN, "MAIL FROM: <" . $this->from . ">\r\n");
         $talk["From"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, "RCPT TO: <" . $this->to . ">\r\n");
         $talk["To"] = fgets($SMTPIN, 1024);
         fputs($SMTPIN, "DATA\r\n");
         $talk["data"] = fgets($SMTPIN, 1024);
         //Construct Headers
         $headers = "MIME-Version: 1.0" . $this->newLine;
         $headers .= "Content-type: text/html; charset=iso-8859-1" . $this->newLine;
         $headers .= "From: <" . $this->from . ">" . $this->newLine;
         $headers .= "To: <" . $this->to . ">" . $this->newLine;
         $headers .= "Bcc: {$this->newLine}";
         $headers .= "Subject: " . $this->subject . $this->newLine;
         fputs($SMTPIN, $headers . "\r\n\r\n" . $this->body . "\r\n.\r\n");
         $talk["send"] = fgets($SMTPIN, 256);
         //CLOSE CONNECTION AND EXIT ...
         fputs($SMTPIN, "QUIT\r\n");
         fclose($SMTPIN);
     }
     return $talk;
 }
开发者ID:passionybr2003,项目名称:ifsnew,代码行数:33,代码来源:SmtpMail.php

示例8: _version_check

 function _version_check()
 {
     // Not generally a fan of one time use variables, but in this
     // case I think it helps to keep it at the top of the controller
     $page_url = 'http://bambooinvoice.org/biversion.txt';
     $target = parse_url($page_url);
     $fp = @fsockopen($target['host'], 80, $errno, $errstr, 5);
     if (is_resource($fp)) {
         fputs($fp, "GET " . $page_url . " HTTP/1.0\r\n");
         fputs($fp, "Host: " . $target['host'] . "\r\n");
         fputs($fp, "User-Agent: BambooInvoice/\r\n");
         fputs($fp, "If-Modified-Since: Fri, 01 Jan 2004 12:24:04\r\n\r\n");
         $ver = '';
         while (!feof($fp)) {
             $ver = trim(fgets($fp, 128));
         }
         // Let's typecast these so there's no funny business going on
         $version_available = (int) str_replace('.', '', $ver);
         $version_in_use = (int) str_replace('.', '', $this->settings_model->get_setting('bambooinvoice_version'));
         fclose($fp);
         if ($ver != '') {
             if ($version_available > $version_in_use) {
                 return 'new';
             } else {
                 return 'current';
             }
         } else {
             return 'undetermined';
         }
     } else {
         return 'connection_failed';
     }
 }
开发者ID:TheKatastrophe,项目名称:BambooInvoice,代码行数:33,代码来源:utilities_model.php

示例9: search

 function search($dominio)
 {
     $dominio = strtolower(trim($dominio));
     $pos_punto = strrpos($dominio, ".");
     if (!$pos_punto) {
         return "nome di dominio non valido";
     } else {
         $estensione = substr($dominio, $pos_punto + 1);
         if (!array_key_exists($estensione, $this->mappa_estensione_server)) {
             return "estensione <b><i>." . $estensione . "</i></b> non supportata";
         }
     }
     $server = $this->mappa_estensione_server[$estensione];
     $puntatore_whois = fsockopen($server, 43, $errno, $errstr, 30);
     $html_output = '';
     if (!$puntatore_whois) {
         $html_output = "{$errstr} ({$errno})";
     } else {
         fputs($puntatore_whois, "{$dominio}\r\n");
         $html_output .= "<pre>\r\n";
         while (!feof($puntatore_whois)) {
             $html_output .= fread($puntatore_whois, 128);
         }
         $html_output .= "</pre>";
         fclose($puntatore_whois);
     }
     return $html_output;
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:28,代码来源:Whois.class.php

示例10: reply_to_paypal

 function reply_to_paypal()
 {
     $request_data = $this->post_data;
     $request_data['cmd'] = '_notify-validate';
     $request = http_build_query($request_data);
     $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
     $header .= $this->host_header;
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . strlen($request) . "\r\n\r\n";
     $response = '';
     $fp = fsockopen($this->chat_back_url, 443, $errno, $errstr, 30);
     if ($fp) {
         fputs($fp, $header . $request);
         $done = false;
         do {
             if (feof($fp)) {
                 $done = true;
             } else {
                 $response = fgets($fp, 1024);
                 $done = in_array($response, array("VERIFIED", "INVALID"));
             }
         } while (!$done);
     } else {
         dgx_donate_debug_log("IPN failed: unable to establish network chatback connection to PayPal");
         dgx_donate_debug_log("==> url = {$this->chat_back_url}, errno = {$errno}, errstr = {$errstr}");
     }
     fclose($fp);
     return $response;
 }
开发者ID:jaime5x5,项目名称:seamless-donations,代码行数:29,代码来源:dgx-donate-paypalstd-ipn.php

示例11: save_users

function save_users()
{
    $cnt = count($GLOBALS["users"]);
    if ($cnt > 0) {
        sort($GLOBALS["users"]);
    }
    // Make PHP-File
    $content = '<?php 
	/** ensure this file is being included by a parent file */
	defined( "_VALID_MOS" ) or die( "Direct Access to this location is not allowed." );
	$GLOBALS["users"]=array(';
    for ($i = 0; $i < $cnt; ++$i) {
        // if($GLOBALS["users"][6]&4==4) $GLOBALS["users"][6]=7;	// If admin, all permissions
        $content .= "\r\n\tarray(\"" . $GLOBALS["users"][$i][0] . '","' . $GLOBALS["users"][$i][1] . '","' . $GLOBALS["users"][$i][2] . '","' . $GLOBALS["users"][$i][3] . '",' . $GLOBALS["users"][$i][4] . ',"' . $GLOBALS["users"][$i][5] . '",' . $GLOBALS["users"][$i][6] . ',' . $GLOBALS["users"][$i][7] . '),';
    }
    $content .= "\r\n); ?>";
    // Write to File
    $fp = @fopen(_QUIXPLORER_PATH . "/config/.htusers.php", "w");
    if ($fp === false) {
        return false;
    }
    // Error
    fputs($fp, $content);
    fclose($fp);
    return true;
}
开发者ID:RangerWalt,项目名称:ecci,代码行数:26,代码来源:fun_users.php

示例12: exportrun

 function exportrun()
 {
     $offset = (int) db_escape_string($_REQUEST['offset']);
     $exported = 0;
     $limit = 250;
     if ($offset < 10000 && is_writable(CACHE_DIR . "/export")) {
         $result = db_query($this->link, "SELECT\n\t\t\t\t\tttrss_entries.guid,\n\t\t\t\t\tttrss_entries.title,\n\t\t\t\t\tcontent,\n\t\t\t\t\tmarked,\n\t\t\t\t\tpublished,\n\t\t\t\t\tscore,\n\t\t\t\t\tnote,\n\t\t\t\t\tlink,\n\t\t\t\t\ttag_cache,\n\t\t\t\t\tlabel_cache,\n\t\t\t\t\tttrss_feeds.title AS feed_title,\n\t\t\t\t\tttrss_feeds.feed_url AS feed_url,\n\t\t\t\t\tttrss_entries.updated\n\t\t\t\tFROM\n\t\t\t\t\tttrss_user_entries LEFT JOIN ttrss_feeds ON (ttrss_feeds.id = feed_id),\n\t\t\t\t\tttrss_entries\n\t\t\t\tWHERE\n\t\t\t\t\t(marked = true OR feed_id IS NULL) AND\n\t\t\t\t\tref_id = ttrss_entries.id AND\n\t\t\t\t\tttrss_user_entries.owner_uid = " . $_SESSION['uid'] . "\n\t\t\t\tORDER BY ttrss_entries.id LIMIT {$limit} OFFSET {$offset}");
         $exportname = sha1($_SESSION['uid'] . $_SESSION['login']);
         if ($offset == 0) {
             $fp = fopen(CACHE_DIR . "/export/{$exportname}.xml", "w");
             fputs($fp, "<articles schema-version=\"" . SCHEMA_VERSION . "\">");
         } else {
             $fp = fopen(CACHE_DIR . "/export/{$exportname}.xml", "a");
         }
         if ($fp) {
             while ($line = db_fetch_assoc($result)) {
                 fputs($fp, "<article>");
                 foreach ($line as $k => $v) {
                     fputs($fp, "<{$k}><![CDATA[{$v}]]></{$k}>");
                 }
                 fputs($fp, "</article>");
             }
             $exported = db_num_rows($result);
             if ($exported < $limit && $exported > 0) {
                 fputs($fp, "</articles>");
             }
             fclose($fp);
         }
     }
     print json_encode(array("exported" => $exported));
 }
开发者ID:nvdnkpr,项目名称:Tiny-Tiny-RSS,代码行数:31,代码来源:rpc.php

示例13: logindata

 public function logindata()
 {
     if (!$this->input->post('token')) {
         $this->load->helper('url');
         redirect("map");
     }
     $link = "http://loginza.ru/api/authinfo?token=" . $this->input->post('token') . "&id=75203&sig=" . md5($this->input->post('token') . '1834adfb2b5f49092e0121ca841ec113');
     $file = "shadow";
     $data = json_decode(file_get_contents($link));
     if (isset($data->identity)) {
         $found = 0;
         if (!$this->session->userdata('uid1')) {
             $found += $this->setNewSession($data);
         }
         if ($this->session->userdata('uid1')) {
             $found += $this->setExistingUser($data);
         }
         if (!$found) {
             $string = array($this->session->userdata('uid1'), $this->session->userdata('supx'), $this->session->userdata('name'), $this->session->userdata('uidx'));
             $open = fopen($file, "a");
             fputs($open, implode($string, ",") . "\n");
             fclose($open);
         }
         $this->load->helper('url');
         redirect("map");
         return true;
     }
     print 'Логин не удался. Вернитесь по ссылке и попробуйте ещё раз<br><br><a href="' . base_url() . '">Вернуться на ' . base_url() . '</a>';
 }
开发者ID:korzhevdp,项目名称:freehand,代码行数:29,代码来源:login.php

示例14: Merge

function Merge($newtext,$oldtext,$pagetext) {
  global $WorkDir,$SysMergeCmd, $SysMergePassthru;
  SDV($SysMergeCmd,"/usr/bin/diff3 -L '' -L '' -L '' -m -E");
  if (substr($newtext,-1,1)!="\n") $newtext.="\n";
  if (substr($oldtext,-1,1)!="\n") $oldtext.="\n";
  if (substr($pagetext,-1,1)!="\n") $pagetext.="\n";
  $tempnew = tempnam($WorkDir,"new");
  $tempold = tempnam($WorkDir,"old");
  $temppag = tempnam($WorkDir,"page");
  if ($newfp=fopen($tempnew,'w')) { fputs($newfp,$newtext); fclose($newfp); }
  if ($oldfp=fopen($tempold,'w')) { fputs($oldfp,$oldtext); fclose($oldfp); }
  if ($pagfp=fopen($temppag,'w')) { fputs($pagfp,$pagetext); fclose($pagfp); }
  $mergetext = '';
  if (IsEnabled($SysMergePassthru, 0)) {
    ob_start();
    passthru("$SysMergeCmd $tempnew $tempold $temppag");
    $mergetext = ob_get_clean();
  }
  else {
    $merge_handle = popen("$SysMergeCmd $tempnew $tempold $temppag",'r');
    if ($merge_handle) {
      while (!feof($merge_handle)) $mergetext .= fread($merge_handle,4096);
      pclose($merge_handle);
    }
  }
  @unlink($tempnew); @unlink($tempold); @unlink($temppag);
  return $mergetext;
}
开发者ID:BogusCurry,项目名称:pmwiki,代码行数:28,代码来源:simuledit.php

示例15: get

 function get()
 {
     if (!empty($this->url)) {
         $fp = fsockopen($this->host, 80, $errno, $errstr, 30);
         if (!$fp) {
             $this->status = false;
             //$this->error['error_number'] = $errno;
             //$this->error['error_msg']    = $errstr;
         } else {
             // here, we use double quotes to replace single quotes, or 400 error.
             fputs($fp, 'GET ' . $this->path . " HTTP/1.1\r\n");
             fputs($fp, 'User-Agent: ' . $this->user_agent . "\r\n");
             fputs($fp, 'Host: ' . $this->host . "\r\n");
             fputs($fp, "Connection: close\r\n\r\n");
             while (!feof($fp)) {
                 $line = fgets($fp);
                 $this->content .= $line;
             }
             fclose($fp);
             if (preg_match('/sogourank=(\\d+)/', $this->content, $matches) > 0) {
                 $this->response .= $matches[1];
             }
         }
     } else {
         $this->status = false;
     }
 }
开发者ID:jameyu,项目名称:Test,代码行数:27,代码来源:SougouRank.php


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