Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将值发送到ASP.net表单_Php_Curl_Sms - Fatal编程技术网

Php 将值发送到ASP.net表单

Php 将值发送到ASP.net表单,php,curl,sms,Php,Curl,Sms,我想向asp.net表单发送一些值,以便通过PHP发送短信,但它不发送任何值,我认为问题出在asp.net表单元素名称上,例如,文本字段的名称是“ctl00$ContentPlaceholder 1$txtnum” 我的代码: <? $text=$_GET['nome']; $strCookie = "ASP.NET_SessionId=uwf4xv55la1ojtjsm0sbnynb;vipcard=210927C5B78543C4A0645F15A561D171F5D3FEA

我想向asp.net表单发送一些值,以便通过PHP发送短信,但它不发送任何值,我认为问题出在asp.net表单元素名称上,例如,文本字段的名称是“ctl00$ContentPlaceholder 1$txtnum”

我的代码:

<?
$text=$_GET['nome'];

    $strCookie = "ASP.NET_SessionId=uwf4xv55la1ojtjsm0sbnynb;vipcard=210927C5B78543C4A0645F15A561D171F5D3FEADF320B173E380799EB6B5086F7472F9910C39496F84C6EF7C86356E5E1BB8E22F9E93C59C347FC7301D954CA669F22E6D4A3655136BD0929FE4AE1A36416DD2FAC65A6CF4EBC3DC5D7907B455C02D1762D11FFEA07C4DA8260371EA4dfgdfA6CEC59A7";
    // set URL and other appropriate options
    $url = 'http://www.sms.com/seller/HomePage.aspx';

//set POST variables
$fields = array(
    'ctl00$ContentPlaceHolder1$txtnum' => '092983940***',
    'ctl00$ContentPlaceHolder1$dds1' => '30001607' ,
    'ctl00$ContentPlaceHolder1$t3' => "hello how are u",
    'ctl00$ContentPlaceHolder1$Button2' => 'submit'
                );

// set user agent
$useragent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5';

//open connection
$ch = curl_init();

//set the url, POST data, UserAgent, Timeout, etc.
curl_setopt( $ch, CURLOPT_COOKIE, $strCookie );
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields);
//curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 500000); //time out of 0.5 seconds.

//execute post
curl_exec($ch);
?>

是否可以将值发送到asp.net表单? 还有其他想法吗?
感谢

可以将数据直接发送到asp.net网页,但是如果该网页不是为处理直接帖子而设计的,它可能会忽略该请求

参考您看到的表单名称,asp.net根据控件在页面层次结构中的位置生成控件名称

名称ctl00$contentplaceholder 1$txtnum表示名为txtnum的字段放在contentplaceholder中

在服务器端,asp.net表单集合将包含一个名为txtnum的表单post变量,而不是用于确保页面唯一性的较长版本

所有这些都是说,如果页面没有设置为处理直接提交的帖子,那么它将忽略发送的数据

ASP.net页面通常使用回发事件工作,这意味着数据处理将放在该按钮控件的onclick事件中,该事件将在页面生命周期内引发和处理

如果您需要直接发布到ASP.net页面,我会与该页面的托管公司联系,看看他们是否有您可以直接发布到的页面或服务