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


PHP COM::open方法代码示例

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


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

示例1: getInvitationList

 /**
  * Get Invitation List from database
  **/
 function getInvitationList()
 {
     // Require DB Config
     require_once "../lib/picasa/config.php";
     // Records Array
     $allRec = array();
     // Create an instance of ADO connection object
     $conn = new COM("ADODB.Connection") or die("Cannot start ADO");
     // Define connection string, specify database driver
     $connStr = "PROVIDER=SQLOLEDB;SERVER=" . $server . ";UID=" . $username . ";PWD=" . $passwd . ";DATABASE=" . $db;
     $conn->open($connStr);
     //Open the connection to the database
     //SQL statement that will query the database
     $query = "SELECT * FROM tbl_picasa";
     //execute SQL statement and return records
     $rs = $conn->execute($query);
     $num_columns = $rs->Fields->Count();
     for ($i = 0; $i < $num_columns; $i++) {
         $fld[$i] = $rs->Fields($i);
     }
     while (!$rs->EOF) {
         $rec = array();
         for ($i = 0; $i < $num_columns; $i++) {
             array_push($rec, $fld[$i]->value);
         }
         array_push($allRec, $rec);
         $rs->MoveNext();
         //move on to the next record
     }
     //close the connection and recordset objects freeing up resources
     $rs->Close();
     $conn->Close();
     $rs = null;
     $conn = null;
     return $allRec;
 }
开发者ID:bayinteractive,项目名称:SWX-Picasa-API,代码行数:39,代码来源:Picasa.php

示例2: COM

<?php

$myServer = "localhost";
$myUser = "stevkky";
$myPass = "stevo177";
$myDB = "hams_BlissDB";
//create an instance of the  ADO connection object
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
//define connection string, specify database driver
$connStr = "PROVIDER=SQLOLEDB;SERVER=" . $myServer . ";UID=" . $myUser . ";PWD=" . $myPass . ";DATABASE=" . $myDB;
$conn->open($connStr);
//Open the connection to the database
//declare the SQL statement that will query the database
$query = "SELECT * FROM Order_from_HAMS";
//execute the SQL statement and return records
$rs = $conn->execute($query);
$num_columns = $rs->Fields->Count();
echo $num_columns . "<br>";
for ($i = 0; $i < $num_columns; $i++) {
    $fld[$i] = $rs->Fields($i);
}
echo "<table>";
while (!$rs->EOF) {
    echo "<tr>";
    for ($i = 0; $i < $num_columns; $i++) {
        echo "<td>" . $fld[$i]->value . "</td>";
    }
    echo "</tr>";
    $rs->MoveNext();
    //move on to the next record
}
开发者ID:caseyi,项目名称:BLIS,代码行数:31,代码来源:hams_connect_test.php

示例3: COM

<?php
$myServer = "192.168.10.212";
$myUser = "webuser";
$myPass = "WU0509Brc";
$myDB = "IABAS2014_ACS_set";

//create an instance of the  ADO connection object
$conn = new COM ("ADODB.Connection")
  or die("Cannot start ADO");

//define connection string, specify database driver
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
  $conn->open($connStr); //Open the connection to the database

//declare the SQL statement that will query the database
$query = "SELECT * FROM CANDIDATOS";

//execute the SQL statement and return records
$rs = $conn->execute($query);

$num_columns = $rs->Fields->Count();
echo $num_columns . "<br>"; 

for ($i=0; $i < $num_columns; $i++) {
    $fld[$i] = $rs->Fields($i);
}

echo "<table>";

while (!$rs->EOF)  //carry on looping through while there are records
开发者ID:Toniato,项目名称:TESTE,代码行数:30,代码来源:EMAIL.PHP

示例4: sendsms

function sendsms($mob, $content)
{
    //add by whh 2015-1-27
    file_put_contents('/tmp/debug', date('m-d H:i:s') . " " . print_r($mob, true) . "\n", FILE_APPEND);
    file_put_contents('/tmp/debug', date('m-d H:i:s') . " " . print_r($content, true) . "\n", FILE_APPEND);
    $server_url = 'http://3tong.net/services/sms?wsdl';
    $user_name = 'dh21944';
    $password = 'kb21944.com';
    include_once dirname(__FILE__) . "/sms/dahan/class.dahansms.php";
    $dahan = new dahanClient();
    $dahan->Client($server_url, $user_name, $password);
    $res = $dahan->dahanSMS($mob, $content);
    //发送短信结束 以下是插入数据库
    $data['telephone'] = $mob;
    $data['send_content'] = $content;
    $data['back_result'] = $res;
    $data['send_time'] = date('Y-m-d H:i:s', time());
    M('sendsms')->add($data);
    return true;
    include_once dirname(__FILE__) . "/sms/dream/class.dream.php";
    $dream = new dream();
    $res = $dream->send($mob, $content);
    file_put_contents('/tmp/debug', date('m-d H:i:s') . " " . print_r($res, true) . "\n", FILE_APPEND);
    return true;
    $msgconfig = FS("Webconfig/msgconfig");
    $type = $msgconfig['sms']['type'];
    // type=0 吉信通短信接口   type=1 漫道短信接口   type=2 亿美短信接口
    if ($type == 0) {
        $uid = $msgconfig['sms']['user1'];
        //分配给你的账号
        $pwd = $msgconfig['sms']['pass1'];
        //密码
        $mob = $mob;
        //发送号码用逗号分隔
        if (PATH_SEPARATOR == ':') {
            //如果是Linux系统,则执行linux短息接口
            $url = "http://service.winic.org:8009/sys_port/gateway/?id=%s&pwd=%s&to=%s&content=%s&time=";
            $id = urlencode($uid);
            $pwd = urlencode($pwd);
            $to = urlencode($mob);
            $content = iconv("UTF-8", "GB2312", $content);
            $rurl = sprintf($url, $id, $pwd, $to, $content);
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_URL, $rurl);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $result = curl_exec($ch);
            curl_close($ch);
            $status = substr($result, 0, 3);
            if ($status === "000") {
                return true;
            } else {
                return false;
            }
        } else {
            $content = urlencode(auto_charset($content, "utf-8", 'gbk'));
            //短信内容
            $sendurl = "http://service.winic.org:8009/sys_port/gateway/?";
            $sdata = "id=" . $uid . "&pwd=" . $pwd . "&to=" . $mob . "&content=" . $content . "&time=";
            $xhr = new COM("MSXML2.XMLHTTP");
            $xhr->open("POST", $sendurl, false);
            $xhr->setRequestHeader("Content-type:", "text/xml;charset=GB2312");
            $xhr->setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            $xhr->send($sdata);
            $data = explode("/", $xhr->responseText);
            if ($data[0] == "000") {
                return true;
            } else {
                return false;
            }
        }
    } elseif ($type == 1) {
        /////////////////////////////////////////漫道短信接口 开始/////////////////////////////////////////////////////////////
        //如果您的系统是utf-8,请转成GB2312 后,再提交、
        $flag = 0;
        //要post的数据
        $argv = array('sn' => $msgconfig['sms']['user2'], 'pwd' => $msgconfig['sms']['pass2'], 'mobile' => $mob, 'content' => iconv("UTF-8", "gb2312//IGNORE", $content), 'ext' => '', 'stime' => '', 'rrid' => '');
        //构造要post的字符串
        foreach ($argv as $key => $value) {
            if ($flag != 0) {
                $params .= "&";
                $flag = 1;
            }
            $params .= $key . "=";
            $params .= urlencode($value);
            $flag = 1;
        }
        $length = strlen($params);
        //创建socket连接
        $fp = fsockopen("sdk2.zucp.net", 8060, $errno, $errstr, 10) or exit($errstr . "--->" . $errno);
        //构造post请求的头
        $header = "POST /webservice.asmx/mt HTTP/1.1\r\n";
        $header .= "Host:sdk2.zucp.net\r\n";
        $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
        $header .= "Content-Length: " . $length . "\r\n";
        $header .= "Connection: Close\r\n\r\n";
        //添加post的字符串
        $header .= $params . "\r\n";
        //发送post的数据
//.........这里部分代码省略.........
开发者ID:GStepOne,项目名称:CI,代码行数:101,代码来源:DataSource.php


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