Tag Archives: request
Send a webrequest and display webresponse along with headers in C#
<%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Net" %> <script language="C#" runat="server"> void btnSubmit_OnClick(Object source, EventArgs e) { // Create a WebRequest WebRequest wrRequest; wrRequest = WebRequestFactory.Create(txtURL.Text); // Get the Response from the Request WebResponse wrResponse = wrRequest.GetResponse(); // Display … Continue reading
Perform a HTTP POST Request with the HttpClient in Android
HTTP POST calls are made with the HttpClient by calling the execute() method of the HttpClient with an instance of HttpPost. We should pass URL-encoded name/value form parameters as part of the HTTP request. import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; … Continue reading
Example of HTTP GET Request using HttpClient in Android
import java.io.IOException; import java.io.InputStreamReader; import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; public class TestHttpGet { public void executeHttpGet() throws Exception { BufferedReader in = null; try { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(); … Continue reading
Example of a SOAP request
This example sends a request to the United States National Weather Service for forecast data that the site has available through SOAP. The entire message is encapsulated within the section, which contains the SOAP body inside the section. <?xml version="1.0" … Continue reading
Request and Display Basic Viewer Data in Open Social
Step 1. Request data: a. Create DataRequest object by calling opensocial.newDataRequest. b. For each request you wish to make, create it using one of the opensocial.new* methods. c. For each piece of data you want to request, add a request … Continue reading
Simple HTTP requestor in c#
The WebRequest class in .NET includes a member named GetResponse that sends a request to the address specified by the Uniform Resource Locator (URL). using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.IO; namespace WRApp { class … Continue reading
View source of webpage using PHP
To read the contents of a webpage from a URL and manipulate it as file, we can use the fopen() php function, which supports the capability of opening URLs. <?php $url = "http://w3mentor.com"; $fp = @fopen($url, ‘r’) or die("Cannot Open … Continue reading
PHP Request variables
argv argv is defined as an array of arguments passed to the script on the command line. When the PHP script is called using the GET method, argv will contain any query string information. argc argc is defined as the … Continue reading
Determine request type in PHP
The $_SERVER['REQUEST_METHOD'] variable can be used to determine whether the request was submitted with the get or post method. In the example below, If the get method was used, we print the form. If the post method was used, we … Continue reading
Create an XML-RPC Request with xmlrpc_encode_request
The process to create an XML-RPC request can be broken up into individual steps: Serialize the PHP data into XML-RPC format Create an XML-RPC request by combining HTTP headers and serialized data Make the call to the service The PHP … Continue reading
PHP XML-RPC Requests
XML-RPC requests are generally sent as HTTP POST requests and hence must have well formed HTTP POST headers. The actual remote call and parameters, in XML format, follows the header as the body of the HTTP request. POST /RPCexample HTTP/1.0 … Continue reading