Skip to content

Commit

Permalink
Merge branch 'master' of github.com:REBELinBLUE/fluent-crawler
Browse files Browse the repository at this point in the history
* 'master' of github.com:REBELinBLUE/fluent-crawler:
  Update README.md
  Update api.md
  Update README.md
  Update README.md
  Update README.md
  • Loading branch information
REBELinBLUE committed Mar 25, 2017
2 parents 147fa00 + e8964fd commit df18b8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ A web scraping library for PHP with a nice fluent interface.

A fork of [laravel/browser-kit-testing](https://github.com/laravel/browser-kit-testing), repurposed to use with real HTTP requests.

Developed for a project I am working on at Sainsbury's.

## Requirements

PHP 7.1+ and Goutte 3.1+
Expand All @@ -24,21 +26,21 @@ composer require fluent-web-crawler

## Usage

Create an instance of the Crawler
**Create an instance of the Crawler**

```php
use REBELinBLUE\Crawler;

$crawler = new Crawler();
```

Visit a URL
**Visit a URL**

```php
$crawler->visit('http://www.example.com');
```

Interact with the response
**Interact with the page**

```php
$crawler->type('username', 'admin')
Expand All @@ -54,7 +56,7 @@ $crawler->submitForm('Login', [

```

or assert the response is as expected
**Check the response is as expected**
```php
if ($crawler->dontSeeText('Hello World')) {
throw new \Exception('The page does not contain the expected text');
Expand All @@ -63,6 +65,7 @@ if ($crawler->dontSeeText('Hello World')) {

For a full list of the available actions see [api.md](api.md).

### Customising the HTTP client settings
If you wish to customize the instance of Goutte which is used (or more likely, the instance of Guzzle), you can
inject your own instance when constructing the class. For example, you may want to increase Guzzle's timeout

Expand All @@ -80,7 +83,6 @@ $crawler = new Crawler($goutteClient);
```

## Further Reading
---------------------

Fluent Crawler is a wrapper around the following PHP libraries.

Expand Down
5 changes: 2 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ $crawler->visit(string $url): self;
```

**Making raw requests**

Of course, it is not always desirable to load a page just so you can go to another, so you are able to make
raw HTTP requests
```php
Expand Down Expand Up @@ -285,7 +284,7 @@ $crawler->getClient(): Client;

## Checking for desired responses

As with the page, you can also test that the response contains expected value.
As with the page, you can also test that the response contains expected values.

You can check the status code

Expand All @@ -306,7 +305,7 @@ $crawler->hasHeader(string $headerName, ?string $value = null): bool;
$crawler->hasCookie(string $cookieName, ?string $value = null): bool;
```

Foe example
For example

```php
// Checks the E-Tag header exists
Expand Down

0 comments on commit df18b8c

Please sign in to comment.