SimpleBrowser::getCurrentCookieValue PHP Method

getCurrentCookieValue() public method

Reads the current cookies for the current URL.
public getCurrentCookieValue ( string $name ) : string
$name string Key of cookie to find.
return string Null if there is no current URL, false if the cookie is not set.
    public function getCurrentCookieValue($name)
    {
        return $this->user_agent->getBaseCookieValue($name, $this->page->getUrl());
    }

Usage Example

コード例 #1
0
 function testCookieReading()
 {
     $browser = new SimpleBrowser();
     $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion());
     $browser->get('http://www.lastcraft.com/test/set_cookies.php');
     $this->assertEqual($browser->getCurrentCookieValue('session_cookie'), 'A');
     $this->assertEqual($browser->getCurrentCookieValue('short_cookie'), 'B');
     $this->assertEqual($browser->getCurrentCookieValue('day_cookie'), 'C');
 }
All Usage Examples Of SimpleBrowser::getCurrentCookieValue