I was wondering if there is a tutorial or example for calling a URL and manipulating the response.
I was wondering if there is a tutorial or example for calling a URL and manipulating the response.
Can you provide a bit more detail?
What do you mean exactly by calling a URL?
Are you trying to call a Web Service at a particular URL?
What type of Web Service?
What type of code is your client program, native, managed .NET, managed JVM?
Thanks
I was wondering if there is a tutorial or example for calling a URL and manipulating the response.
In C# it is done by instantiating a web browser object, setting the url, and using the methods to send the request and receive the response.
I was wondering if there is a tutorial or example for calling a URL and manipulating the response.
If you are then you should be able to perform this function using the same class and methods that you do in C#.
If you post the example C# code I will convert it to the equivalent COBOL for you...
I was wondering if there is a tutorial or example for calling a URL and manipulating the response.
I was wondering if there is a tutorial or example for calling a URL and manipulating the response.
I used HttpWebRequest instead, but this returns a value from Google's main site. Console app.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
namespace WebBrowserConsoleApplication
{
class Program
{
static void Main(string[] args)
{
var webAddr = "https://www.google.com";
var httpWebRequest = (HttpWebRequest) WebRequest.Create(webAddr);
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
httpWebRequest.Method = "GET";
var httpResponse = (HttpWebResponse) httpWebRequest.GetResponse();
using(var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
Console.WriteLine(result);
}
}
}
}
I was wondering if there is a tutorial or example for calling a URL and manipulating the response.
The Visual COBOL equivalent to this using a program instead of a class would be (you could use either)
$set ilusing"System"
$set ilusing"System.Collections.Generic"
$set ilusing"System.IO"
$set ilusing"System.Net"
$set ilusing"System.Text"
program-id. Program1 as "WebBrowserConsoleApplication.Program1".
procedure division.
declare webAddr = "https://www.google.com"
declare httpWebRequest = type WebRequest::Create(webAddr) as type HttpWebRequest
set httpWebRequest::ContentType = "application/x-www-form-urlencoded"
set httpWebRequest::Method = "GET"
declare httpResponse = httpWebRequest::GetResponse as type HttpWebResponse
perform using streamReader as type StreamReader = new type StreamReader(httpResponse::GetResponseStream)
declare result = streamReader::ReadToEnd
invoke type Console::WriteLine(result)
end-perform
goback.
end program Program1.
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.