标签: way2sms

使用way2sms api发送短信

我想用way2sms发送短信.我试过以下代码

login.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
  public partial class Login : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnconnect_Click(object sender, EventArgs e)
    {
        Session["id"] = txtmobileno.Text;
        Session["pw"] = txtpw.Text;
        Response.Redirect("/send.aspx");
    }
  }
 }
Run Code Online (Sandbox Code Playgroud)

send.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions; …
Run Code Online (Sandbox Code Playgroud)

c# asp.net way2sms

14
推荐指数
1
解决办法
3万
查看次数

通过Perl中的Way2sms自动发送短信

我正在尝试使用Perl LWP通过Way2sms发送短信.登录部分成功,之后我将cookie保存到本地文件.登录后的欢迎页面显示发送短信链接,点击哪一个被重定向到另一个页面,其中有两个用于移动号码和短信文本的输入以及一个用于提交和发送短信的按钮.Firebug显示页面结构,如图所示.从Iframe网址和表单的action属性,我构造了表单操作的绝对URL并相应地提交表单,并将cookie存储在文件中.但是,短信不会被发送.我在这做错了什么?代码如下.(name两个文本输入的属性是正确的,通过观察Firebug中的源代码来获取,尽管图像中未包含该代码)

use LWP::UserAgent;
open f, "> way2sms.txt";
use HTTP::Cookies;
my $cookie_jar = HTTP::Cookies->new(
file => "cookies.txt",
autosave => 1,
);

my $ua = LWP::UserAgent->new(
    agent =>
      'Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1',
    cookie_jar => $cookie_jar,
);
my $response = $ua->post(
    'http://site2.way2sms.com/contentt/bar/Login1.action',
    {
        username => $user,
        password => $pass,
    }
);

if ( $response->is_redirect ) {
    $response = $ua->get( $response->header('Location') );
    print 5 if $response->decoded_content =~ /Kaustav Mukherjee/i; #prints it, showing that the …
Run Code Online (Sandbox Code Playgroud)

perl lwp lwp-useragent way2sms

6
推荐指数
1
解决办法
4317
查看次数

标签 统计

way2sms ×2

asp.net ×1

c# ×1

lwp ×1

lwp-useragent ×1

perl ×1