施用PHP Snoopy同步数据到.net系统
使用PHP Snoopy同步数据到.net系统
??? 很久没有做web了,今天一个同事朋友说她那里有需求将PHP网站数据同步到.net网站系统里面,给自己下面的人做了几天都没有结果,呵呵。请求帮忙,这个很简单。跨语言通讯2000年时候最流行就是使用Corba了(叫什么公用对象XX框架,华为管理电信机房东东就这个做了,C++和java通讯),目前简单实现就是webservice或RPC,远程网站开一个请求入口,本地去请求这个入口返回xml数据解析。类似这样的服务。通常java对PHP使用 RMI或Hessian等框架,PHP对其他语言使用Hessian或http Snoopy通讯,Actionscript对PHP或java使用amf或其他RPC通讯框架。好了,不卖官子了。我大概就讲讲snoopy对.net实现数据同步。
??? 一·在.net系统公开一个接口,简单说就是写.aspx页面接收远程数据(在本例就是远程网站用户注册以后的信息如用户id,用户姓名等)。建立一个RemoteService.aspx页面大致代码如下:
??? String userid=Resquet.QueryString("userid");
String userName=Resquet.QueryString("userName");
SqlConnection
con = new SqlConnection("server=xx;database=school;uid=sa;pwd=luodongfu");
comm = new SqlCommand("insert into XXX() ..."");
?? 下面就是把这些东西保存到你.net数据库了,几年没有用过.net,忘记了自己google看一下。别忘记做安全以及重复验证哦,这里。
?
?二 .在php? Discuz 的lib引入snoopy.php (自己去下载)注册成功返回页面上如下些:
include("snoopy.php");
$snoopy = new Snoopy;
$formvars["userName"] = "luodongfu";
$formvars["userid"] = "123456";
这个网站及就是我们上面写的那个系统页面了
$action = "http://www.luodongfu.cn/RemoteService.aspx"/;//表单提交地址
$snoopy->submit($action,$formvars);//$formvars为提交的数组
?
ok,就这么简单,半个小时搞定,那应该算时间都太多了。这是最简单的基本功,呵呵

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide
