我正在为手机号码开发一个选择加入/退出 API,它可以放置在任何网站的顶部,因此人们可以订阅接收他们手机号码的短信。
我有以下脚本,它基本上在我的 PHP 网站 USING 之间发布数据,Curl
它工作得很好:
<?php
$url = "http://myserverurl.com/optin.php";
$postdata['customer_id'] = "1";
$postdata['mobilenumber'] = $_POST['mobilenumber'];
$useragent= "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" ;
$ch = curl_init();
//set some cookie details up (depending on the site)
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_USERAGENT, $useragent); //set our user agent
curl_setopt($ch, CURLOPT_POST, 1); //set how many paramaters
curl_setopt($ch, CURLOPT_URL,$url); //set the url we want to use
curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata); //set data to post
$result= curl_exec ($ch); //execute and get the results
curl_close ($ch);
//print $result; //display the reuslt
?>
如果网站在,如何应用这种方法ASP.net
?有什么类似于Curl
in 的ASP.net
吗?
谢谢,