I want to send some value to a asp.net form for sending sms by PHP but it doesnt send any value , i think the problem is from asp.net form element name for example a name of text field is “ctl00$ContentPlaceHolder1$txtnum”
my code :
<?
$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);
?>
is this possible to send value to asp.net form ?
is there any other idea ?
Thanks
It is possible to send data directly to an asp.net web page, however it may ignore the request if it isn’t designed to process direct posts.
In reference to the form names you are seeing asp.net builds control names based on their location in the page hierarchy.
The name ctl00$ContentPlaceHolder1$txtnum implies that the field named txtnum is placed inside a contentplaceholder.
On the server side the asp.net form collection will contain a form post variable named txtnum, and not the longer version which is there to ensure uniqueness within the page.
All this being said if the page is not setup to process direct post submissions then it will ignore the data being sent.
ASP.net pages typically will work using post back events which means the processing of the data will be placed inside an onclick event for that button control, the event is raised and handled within the page lifecycle.
If you need to post directly to the ASP.net page I would check with the company hosting the page if they have a page or service that you can post directly to.