Mobile App for an existing website without creating API
Actually everything in the web is a service. When you enter to a website lots of things doing in behind the door. Your browser makes GET request to the server. In this request sending cookie data, browser capabilities and data for server process. A typical GET request is seems like that:
GET / HTTP/1.1 Accept-Encoding:gzip, deflate, sdch, br Accept-Language:en-US,en;q=0.8 Cache-Control:no-cache Connection:Upgrade Cookie:foo=bar; foo2=bar2; foo3=bar3; foo4=bar4 DNT:1 Host:stackoverflow.com Origin:http://stackoverflow.com Pragma:no-cache User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
When server receives this request then web server program (Apache, Nginx, Tomcat etc…) makes some operations and returns a result.
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Content-Encoding: gzip Content-Length: 23095 Accept-Ranges: bytes Date: Mon, 10 Apr 2017 20:44:06 GMT Via: 1.1 varnish Connection: keep-alive Set-Cookie: foo6=bar6; foo7;bar7; PHPSESSIONID=aergaegaergaergaerg Vary: Accept-Encoding,Fastly-SSL Cache-Control: private <!DOCTYPE html> <html itemscope itemtype="http://schema.org/QAPage"> <head> <title>Stack Overflow</title> <link rel="shortcut icon" href="https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico?v=4f32ecc8f43d"> <link rel="apple-touch-icon image_src" href="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png?v=c78bd457575a"> .................
This is an example communication between client and server. This is our main point. If you don’t want to write API to your existing web site then you have to make three tings. First: handle incoming-outgoing “cookie” headers. Second: parse incoming HTML data. Three: make POST or GET request correctly.
0 yorum