[TASK] TCP Client - Make HTTP Request

[TASK] TCP Client - Make HTTP Request

Postby admin » Tue Oct 17, 2017 6:23 pm

What is HTTP?
HTTP means HyperText Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands.
For example, when you enter a URL in your browser, this actually sends an HTTP command to the Web server directing it to fetch and transmit the requested Web page. The other main standard that controls how the World Wide Web works is HTML, which covers how Web pages are formatted and displayed.

From https://www.webopedia.com/TERM/H/HTTP.html

PHPoC has an embedded web server. You can upload your web page to PHPoC, and then open a Web Browser to access this web page. In this case, PHPoC is an HTTP server and Web Browser is HTTP client.

The example below shows the different thing. PHPoC acts as HTTP client, making HTTP request to a Web Sever. In this case, PHPoC acts similarly to a Web Browser, but not visualize the web page.

Since HTTP is application protocol and operate over TCP, this example is also a way to learn how to create TCP client on PHPoC.

Now, let's start!

1. Make sure that your PHPoC Blue or Black is connected to the Internet.

2. Please download a PSP (PHPoC Support Package) of libraries and examples from PHPoC.

3. Connect PHPoC Blue or Black to your PC via USB cable.

4. Run PHPoC Debugger.

5. Upload all libraries in PSP to your PHPoC Blue or Black through PHPoC Debugger.
In fact, you only need to upload sn_dns.php file in this example. But for future use, you can upload all.
※ Note that the libraries should be located in the /lib folder.
psp_lib.png (8.84 KiB) Viewed 71 times

6. Find an example of E-mail (SMTP) in the PSP.
psp_http_get_files.JPG (8.66 KiB) Viewed 71 times

7. Upload init.php and task0.php files to your PHPoC Blue or Black.
※ Note that the init.php and task0.php files should be located in the root folder.
psp_phpoc_files.png (2.22 KiB) Viewed 71 times

8. Modify URL of web server in task0.php file.
psp_http_get_modified.JPG (45.17 KiB) Viewed 71 times

9. Upload the task0.php to your PHPoC Blue or Black again.

10. Run the example and see the result.
psp_http_get_result.JPG (36.39 KiB) Viewed 71 times
Site Admin
Posts: 166
Joined: Mon Jan 20, 2014 4:40 pm

Return to Example

Who is online

Users browsing this forum: No registered users and 1 guest