HTTPProvider Object
Sample HTTPProvider script
//**********************************************//
// ActiveScripting example (JScript)
//**********************************************//
// This script contacts the site specified by the user URL,
// copies its source code and displays the page in the internal
// browser of the application
//**********************************************//
function Main (){
var sDocName;
var sMessage;
with (Application){
if (HTTPProvider.State == 0){
// Set the URL property of HTTPProvider Object.
HTTPProvider.URL = InputBox(VersionText, "Please Enter the URL.",
// Perform HTTP Get Request
HTTPProvider.Get();
sSource = '';
if (HTTPProvider.ReasonPhrase == "OK") // Check if the requested
else{
sMessage = "The source of the requested page has been copied
sMessage = sMessage + 'the page now will be displayed ';
sMessage = sMessage + 'in the browse window of \n' + VersionText +
MessageBox (sMessage, VersionText, 0);
}
else{
sSource
sSource =
}
MessageBox("Some images may not be downloaded properly!","Warning!",0);
NewDocument (false);
ActiveDocument.InsertText(sSource, false); // Insert the received
CurrentView = 2;// Change to the browse mode.
}
}
var sSource;
"http://www.yahoo.com");
URL can be displayed
sSource = HTTPProvider.ReceivedStreamAsString;
source into the string
sSource = '<font size="+2" color="#0000ff" >'
cannot be displayed, post error message and show a reason.
sSource =
sSource + 'The request could not be completed:
<br><br><li>'
sSource =
sSource + HTTPProvider.ReasonPhrase + '.</font></
li>';
}
successfully,\n";
'!';
= 'You are not connected to Internet properly, ';
sSource + 'please check the connection and try again';
// Initialize a new document.
source code into new document.
269
//Save the page
//If the page
Need help?
Do you have a question about the COLDFUSION STUDIO 5-USING COLDFUSION 5 STUDIO and is the answer not in the manual?