@edit:
fixed everything and decoded the view state and this is what I got now, still isn't working, it takes me to a html with all these functions:
<script type="text/javascript">
//<![CDATA[
var Page_ValidationSummaries = new Array(document.getElementById("ctl00_Blank_ctl00_vsEnviar"));
var Page_Validators = new Array(document.getElementById("ctl00_Blank_ctl00_rfvNumDDD"), document.getElementById("ctl00_Blank_ctl00_ctvDDD"), document.getElementById("ctl00_Blank_ctl00_rfvNumTelefone"), document.getElementById("ctl00_Blank_ctl00_ctvTelefone"), document.getElementById("ctl00_Blank_ctl00_rfvMensagem"));
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
var ctl00_Blank_ctl00_rfvNumDDD = document.all ? document.all["ctl00_Blank_ctl00_rfvNumDDD"] : document.getElementById("ctl00_Blank_ctl00_rfvNumDDD");
ctl00_Blank_ctl00_rfvNumDDD.controltovalidate = "ctl00_Blank_ctl00_txtNumDDD";
ctl00_Blank_ctl00_rfvNumDDD.focusOnError = "t";
ctl00_Blank_ctl00_rfvNumDDD.errormessage = "DDD";
ctl00_Blank_ctl00_rfvNumDDD.display = "None";
ctl00_Blank_ctl00_rfvNumDDD.validationGroup = "Enviar";
ctl00_Blank_ctl00_rfvNumDDD.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
ctl00_Blank_ctl00_rfvNumDDD.initialvalue = "";
var ctl00_Blank_ctl00_ctvDDD = document.all ? document.all["ctl00_Blank_ctl00_ctvDDD"] : document.getElementById("ctl00_Blank_ctl00_ctvDDD");
ctl00_Blank_ctl00_ctvDDD.errormessage = "DDD com 2 dígitos";
ctl00_Blank_ctl00_ctvDDD.display = "None";
ctl00_Blank_ctl00_ctvDDD.validationGroup = "Enviar";
ctl00_Blank_ctl00_ctvDDD.evaluationfunction = "CustomValidatorEvaluateIsValid";
ctl00_Blank_ctl00_ctvDDD.clientvalidationfunction = "ValidarDDD";
ctl00_Blank_ctl00_ctvDDD.validateemptytext = "true";
var ctl00_Blank_ctl00_rfvNumTelefone = document.all ? document.all["ctl00_Blank_ctl00_rfvNumTelefone"] : document.getElementById("ctl00_Blank_ctl00_rfvNumTelefone");
ctl00_Blank_ctl00_rfvNumTelefone.controltovalidate = "ctl00_Blank_ctl00_txtNumTelefone";
ctl00_Blank_ctl00_rfvNumTelefone.focusOnError = "t";
ctl00_Blank_ctl00_rfvNumTelefone.errormessage = "Telefone";
ctl00_Blank_ctl00_rfvNumTelefone.display = "None";
ctl00_Blank_ctl00_rfvNumTelefone.validationGroup = "Enviar";
ctl00_Blank_ctl00_rfvNumTelefone.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
ctl00_Blank_ctl00_rfvNumTelefone.initialvalue = "";
var ctl00_Blank_ctl00_ctvTelefone = document.all ? document.all["ctl00_Blank_ctl00_ctvTelefone"] : document.getElementById("ctl00_Blank_ctl00_ctvTelefone");
ctl00_Blank_ctl00_ctvTelefone.errormessage = "Telefone com 8 dígitos";
ctl00_Blank_ctl00_ctvTelefone.display = "None";
ctl00_Blank_ctl00_ctvTelefone.validationGroup = "Enviar";
ctl00_Blank_ctl00_ctvTelefone.evaluationfunction = "CustomValidatorEvaluateIsValid";
ctl00_Blank_ctl00_ctvTelefone.clientvalidationfunction = "ValidarTelefone";
ctl00_Blank_ctl00_ctvTelefone.validateemptytext = "true";
var ctl00_Blank_ctl00_rfvMensagem = document.all ? document.all["ctl00_Blank_ctl00_rfvMensagem"] : document.getElementById("ctl00_Blank_ctl00_rfvMensagem");
ctl00_Blank_ctl00_rfvMensagem.controltovalidate = "ctl00_Blank_ctl00_txtMensagem";
ctl00_Blank_ctl00_rfvMensagem.focusOnError = "t";
ctl00_Blank_ctl00_rfvMensagem.errormessage = "Mensagem";
ctl00_Blank_ctl00_rfvMensagem.display = "None";
ctl00_Blank_ctl00_rfvMensagem.validationGroup = "Enviar";
ctl00_Blank_ctl00_rfvMensagem.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
ctl00_Blank_ctl00_rfvMensagem.initialvalue = "";
var ctl00_Blank_ctl00_vsEnviar = document.all ? document.all["ctl00_Blank_ctl00_vsEnviar"] : document.getElementById("ctl00_Blank_ctl00_vsEnviar");
ctl00_Blank_ctl00_vsEnviar.headertext = "Campos de preenchimento obrigatório:";
ctl00_Blank_ctl00_vsEnviar.showmessagebox = "True";
ctl00_Blank_ctl00_vsEnviar.showsummary = "False";
ctl00_Blank_ctl00_vsEnviar.validationGroup = "Enviar";
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
Sys.Application.add_load(FirejQuery);
var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function") {
ValidatorOnLoad();
}
function ValidatorOnSubm开发者_JAVA技巧it() {
if (Page_ValidationActive) {
return ValidatorCommonOnSubmit();
}
else {
return true;
}
}
document.getElementById('ctl00_Blank_ctl00_vsEnviar').dispose = function() {
Array.remove(Page_ValidationSummaries, document.getElementById('ctl00_Blank_ctl00_vsEnviar'));
}
Sys.Application.initialize();
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbCpfCnpj"}, null, null, $get("ctl00_Blank_ctl00_txtCPFCNPJ"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbCPFAlterarCadastro"}, null, null, $get("ctl00_Blank_ctl00_txtCPFAlterarCadastro"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbDDDAlterarCadastro"}, null, null, $get("ctl00_Blank_ctl00_txtDDDAlterarCadastro"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbTelefoneAlterarCadastro"}, null, null, $get("ctl00_Blank_ctl00_txtTelefoneAlterarCadastro"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbCPFAlterarCadastroNC"}, null, null, $get("ctl00_Blank_ctl00_txtCPFAlterarCadastroNC"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbDDDAlterarCadastroNC"}, null, null, $get("ctl00_Blank_ctl00_txtDDDAlterarCadastroNC"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbTelefoneAlterarCadastroNC"}, null, null, $get("ctl00_Blank_ctl00_txtTelefoneAlterarCadastroNC"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbCEP1AlterarCadastroNC"}, null, null, $get("ctl00_Blank_ctl00_txtCEP1AlterarCadastroNC"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbCEP2AlterarCadastroNC"}, null, null, $get("ctl00_Blank_ctl00_txtCEP2AlterarCadastroNC"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbCPFEsqueciSenha"}, null, null, $get("ctl00_Blank_ctl00_txtCPFEsqueciSenha"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbCPFAlterarSenha"}, null, null, $get("ctl00_Blank_ctl00_txtCPFAlterarSenhaNC"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbSenhaAtualAlterarSenhaNC"}, null, null, $get("ctl00_Blank_ctl00_txtSenhaAtualAlterarSenhaNC"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbNovaSenhaAlterarSenhaNC"}, null, null, $get("ctl00_Blank_ctl00_txtNovaSenhaAlterarSenhaNC"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbConfirmeNovaSenhaAlterarSenhaNC"}, null, null, $get("ctl00_Blank_ctl00_txtConfirmeNovaSenhaAlterarSenhaNC"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbNumDDD"}, null, null, $get("ctl00_Blank_ctl00_txtNumDDD"));
});
document.getElementById('ctl00_Blank_ctl00_rfvNumDDD').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_Blank_ctl00_rfvNumDDD'));
}
document.getElementById('ctl00_Blank_ctl00_ctvDDD').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_Blank_ctl00_ctvDDD'));
}
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"ctl00_Blank_ctl00_ftbNumTelefone"}, null, null, $get("ctl00_Blank_ctl00_txtNumTelefone"));
});
document.getElementById('ctl00_Blank_ctl00_rfvNumTelefone').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_Blank_ctl00_rfvNumTelefone'));
}
document.getElementById('ctl00_Blank_ctl00_ctvTelefone').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_Blank_ctl00_ctvTelefone'));
}
document.getElementById('ctl00_Blank_ctl00_rfvMensagem').dispose = function() {
Array.remove(Page_Validators, document.getElementById('ctl00_Blank_ctl00_rfvMensagem'));
}
//]]>
</script>
</form>
<!-- START OF SmartSource Data Collector TAG -->
<script src="/nextelwebsite/js/webtrends.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var _tag=new WebTrends();
_tag.dcsGetId();
//]]>>
</script>
<script type="text/javascript">
//<![CDATA[
// Add custom parameters here.
//_tag.DCSext.param_name=param_value;
_tag.dcsCollect();
//]]>>
</script>
<noscript>
<div>
<img alt="DCSIMG" id="DCSIMG" width="1" height="1" src="http://sdc.nextel.com.br/dcslz078000000wgujjv96o3y_8x7v/njs.gif?dcsuri=/nojavascript&WT.js=No&WT.tv=8.6.2" /></div>
</noscript>
<!-- END OF SmartSource Data Collector TAG -->
<script type="text/javascript" src="/nextelwebsite/js/Common.min.js"></script>
</body>
</html>
And this is my current code:
<?php
include('pegaForms.php');
echo pegaMaterias();
function pegaMaterias()
{
$header = array("Host: nextel.com.br", "Proxy-Connection: keep-alive", "Referer: http", "Content-Length: 3382", "Origin: http", "Cache-Control: no-cache", "X-MicrosoftAjax: Delta=true", "User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1 Paros/3.2.13", "Content-Type: application/x-www-form-urlencoded; charset=UTF-8", "Accept: */*", "Accept-Encoding: sdch", "Accept-Language: en-US,en;q=0.8", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3", "Cookie: cAtm=a; ASP.NET_SessionId=wmqaqt55yswgyd45a31avb45; WT_FPC=id=139.82.60.168-3061391072.30168743:lv=1313586431216:ss=1313584965026");
$array_parametros = array();
$array_parametros['ctl00_ScriptManager1'] = "ctl00\_Blank\_ctl00\_upSMS|ctl00\_Blank\_ctl00\_lkbEnviarSMS";
$array_parametros['ctl00_Blank_ctl00_hidUpdate'] = "";
$array_parametros['ctl00_Blank_ctl00_txtTipoCliente'] = "S";
$array_parametros['ctl00_Blank_ctl00_txtAlert'] = "";
$array_parametros['ctl00_Blank_ctl00_txtjQuery'] = "";
$array_parametros['ctl00_Blank_ctl00_txtFleetID'] = "";
$array_parametros['ctl00_Blank_ctl00_txtSenhaIndividual'] = "";
$array_parametros['ctl00_Blank_ctl00_txtCPFCNPJ'] = "";
$array_parametros['ctl00_Blank_ctl00_txtSenha'] = "";
$array_parametros['ctl00_Blank_ctl00_caracteres'] = "";
$array_parametros['ctl00_Blank_ctl00_txtFleetIDAlterarCadastro'] = "";
$array_parametros['ctl00_Blank_ctl00_txtCPFAlterarCadastro'] = "";
$array_parametros['ctl00_Blank_ctl00_txtNomeAlterarCadastro'] = "";
$array_parametros['ctl00_Blank_ctl00_txtEmpresaAlterarCadastro'] = "";
$array_parametros['ctl00_Blank_ctl00_txtDDDAlterarCadastro'] = "";
$array_parametros['ctl00_Blank_ctl00_txtTelefoneAlterarCadastro'] = "";
$array_parametros['ctl00_Blank_ctl00_txtEmailAlterarCadastro'] = "";
$array_parametros['ctl00_Blank_ctl00_txtCPFAlterarCadastroNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtNomeAlterarCadastroNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtEmpresaAlterarCadastroNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtDDDAlterarCadastroNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtTelefoneAlterarCadastroNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtCEP1AlterarCadastroNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtCEP2AlterarCadastroNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtEmailAlterarCadastroNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtFleetIDEsqueciSenha'] = "";
$array_parametros['ctl00_Blank_ctl00_txtEmailEsqueciSenha'] = "";
$array_parametros['ctl00_Blank_ctl00_txtCPFEsqueciSenha'] = "";
$array_parametros['ctl00_Blank_ctl00_txtCPFAlterarSenhaNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtSenhaAtualAlterarSenhaNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtNovaSenhaAlterarSenhaNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtConfirmeNovaSenhaAlterarSenhaNC'] = "";
$array_parametros['ctl00_Blank_ctl00_txtNumDDD'] = "21";
$array_parametros['ctl00_Blank_ctl00_txtNumTelefone'] = "number";
$array_parametros['ctl00_Blank_ctl00_txtMensagem'] = "banana phone";
$array_parametros['ctl00_Blank_ctl00_txtContador'] = "108";
$array_parametros['__EVENTTARGET'] = "ctl00\_Blank\_ctl00\_lkbEnviarSMS";
$array_parametros['__EVENTARGUMENT'] = "";
$array_parametros['__VIEWSTATE'] = "5381
/NextelWebSite/NextelControls/wfGeraImagem.aspx?27b18018-88e1-4f2c-8f7a-e1d1a50497d4=zq9I&t=7032
MoveNext(0, 'ctl00_Blank_ctl00_txtNumDDD', 'ctl00_Blank_ctl00_txtNumTelefone', event);
MoveNext(0, 'ctl00_Blank_ctl00_txtNumDDD', 'ctl00_Blank_ctl00_txtNumTelefone', event);
MoveNext(0, 'ctl00_Blank_ctl00_txtNumTelefone', 'ctl00_Blank_ctl00_txtMensagem', event);
MoveNext(0, 'ctl00_Blank_ctl00_txtNumTelefone', 'ctl00_Blank_ctl00_txtMensagem', event);
120";
$array_parametros['__EVENTVALIDATION'] = "";
$array_parametros['__ASYNCPOST'] = "true";
//$array_parametros = format_postfields($array_parametros);
//echo $array_parametros;
$ch = curl_init();
$URL = "http://nextel.com.br/NextelWebSite/produtos/mensagens/sms/enviar_conteudo_copy1.aspx";
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_POSTFIELDS, $array_parametros);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_VERBOSE, FALSE);
$ret = curl_exec($ch);
return $ret;
}
?>
A few of problems I see
*) Values are url encoded
this should be ctl00%24Blank%24ctl00%24txtTipoCliente => ctl00$Blank$ctl00$txtTipoCliente
You can use this to correct the parameters http://meyerweb.com/eric/tools/dencoder/ or run them through php urldecode
*) The part after the equal should go in the value
this
$array_parametros['ctl00%24Blank%24ctl00%24txtTipoCliente=S'] = "";
should be
$array_parametros['ctl00$Blank$ctl00$txtTipoCliente'] = "S";
*) ASP.NET and ViewState encryption
The __VIEWSTATE suggest the server is using ASP.NET and the VIEWSTATE is likely encrypted. This means it might be very difficult to accomplish what you are trying withough getting sessionid/cookies.
I am guessing but I believe the error page you are getting is due to view state validation failing but I could be wrong. Try to fix the request parameters as described above and see if it works for you.
精彩评论