Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » system facilities » splitWWW
next | previous | forward | backward | up | index | toc

# splitWWW -- separate an http response into header and body

- Usage:
    `(head, body) = splitWWW str`
- Inputs:
  - str, a string, an http response, such as that returned by getWWW.
- Outputs:
  - head, a string, the header of the response
  - body, a string, the response body, which has been 'unchunked', if the response type is chunked.

## Description

The format of chunked data is described here.

The following is an example obtaining 5 examples from the Kreuzer-Skarke database for 4 dimensional reflexive polytopes. We retrieve 5 examples each having the anti-canonical divisor a Calabi-Yau with $h^{(1,1)} = 10$.

    i1 : str = getWWW "http://quark.itp.tuwien.ac.at/cgi-bin/cy/cydata.cgi?h11=10&L=5";

    i2 : (head,body) = splitWWW str;

    i3 : head

    o3 = HTTP/1.1 200 OK
         Date: Thu, 23 Jun 2016 12:10:58 GMT
         Server: Apache/2.2
         Vary: Accept-Encoding
         Connection: close
         Transfer-Encoding: chunked
         Content-Type: text/html; charset=UTF-8

    i4 : body

    o4 = <head><title>SEARCH RESULTS</title></head>
         <body><pre><b>Search command:</b>
         class.x -di x -He EH10:MVNFL5

         <b>Result:</b>
         4 9  M:22 9 N:14 8 H:10,18 [-16]
            1   0   1   0   2   0  -2  -2  -2
            0   1   0   0  -1   1   1  -1   1
            0   0   2   0   1   1  -3  -1  -4
            0   0   0   1   1   1  -1  -1  -2
         4 10  M:23 10 N:15 10 H:10,18 [-16]
             1    0    0    0   -1    1   -2    2    0   -1
             0    1    0    0    1   -1    2   -1   -2    0
             0    0    1    0   -1    1   -1    0    2   -2
             0    0    0    1    1   -1    0   -2   -1    2
         4 9  M:24 9 N:14 8 H:10,20 [-20]
            1   0   1   0   1  -1  -2   1  -2
            0   1   0   0   0   2  -2  -1   2
            0   0   2   0  -1  -1   0  -2  -2
            0   0   0   1  -1  -1   1  -1  -1
         4 11  M:25 11 N:15 10 H:10,20 [-20]
            1   0   0   0   2  -2   0   2  -2  -2   2
            0   1   0   0  -1   1   1  -1   0   1  -2
            0   0   1   0  -1   1  -1   0   2   0  -2
            0   0   0   1  -1   1   1  -2   1   0  -1
         4 10  M:25 10 N:15 10 H:10,20 [-20]
             1    0    0    0   -1    0   -1   -1    2    1
             0    1    0    0    0    0    2    0   -1   -2
             0    0    1    0    0   -2    2    2   -2   -2
             0    0    0    1    0   -1    0    2    0   -2
         Exceeded limit of 5
         </pre></body>

## See also

- getWWW -- get a web page

## Ways to use splitWWW:

- `splitWWW(String)`

## For the programmer

The object splitWWW is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/ov_system.m2:1807:0.