SimpleBrowser::post PHP Method

post() public method

Fetches the page content with a POST request.
public post ( string/SimpleUrl $url, hash/SimpleFormEncoding $parameters = false, string $content_type = false ) : string
$url string/SimpleUrl
$parameters hash/SimpleFormEncoding
$content_type string MIME Content-Type of the request body
return string Content of page.
    public function post($url, $parameters = false, $content_type = false)
    {
        if (!is_object($url)) {
            $url = new SimpleUrl($url);
        }
        if ($this->getUrl()) {
            $url = $url->makeAbsolute($this->getUrl());
        }
        return $this->load($url, new SimplePostEncoding($parameters, $content_type));
    }

Usage Example

コード例 #1
0
 function testPost()
 {
     $browser = new SimpleBrowser();
     $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion());
     $this->assertTrue($browser->post('http://www.lastcraft.com/test/network_confirm.php'));
     $this->assertPattern('/target for the SimpleTest/', $browser->getContent());
     $this->assertPattern('/Request method.*?<dd>POST<\\/dd>/', $browser->getContent());
 }
All Usage Examples Of SimpleBrowser::post