Laravel Guzzle getting destination and due time from a page

All we need is an easy explanation of the problem, so here it is.

I want my website to scrape information from this page‌​m and in particular I want to scrape destination and due time from that website and give me an output.

At this moment my controller looks like this:

function guzzle(){
$client = new \GuzzleHttp\Client();
$results = $client->get('');
//return view('hello')->with('results', $results);
return view('hello');

And the output is:

Response {#190 ▼
  -reasonPhrase: "OK"
  -statusCode: 200
  -headers: array:8 [▼
    "Content-Security-Policy" => array:1 [▶]
    "Content-Type" => array:1 [▶]
    "Date" => array:1 [▶]
    "ETag" => array:1 [▶]
    "X-Content-Security-Policy" => array:1 [▶]
    "X-WebKit-CSP" => array:1 [▶]
    "Content-Length" => array:1 [▶]
    "Connection" => array:1 [▶]
  -headerNames: array:8 [▼
    "content-security-policy" => "Content-Security-Policy"
    "content-type" => "Content-Type"
    "date" => "Date"
    "etag" => "ETag"
    "x-content-security-policy" => "X-Content-Security-Policy"
    "x-webkit-csp" => "X-WebKit-CSP"
    "content-length" => "Content-Length"
    "connection" => "Connection"
  -protocol: "1.1"
  -stream: Stream {#188 ▶}

However how can I access specific html class, scrape information from it and output it on my page?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

dd is not useful for you here, try this :

$client = new \GuzzleHttp\Client();
$results = $client->get('');

print_r($results->getBody()->getContents()); // The HTML content

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply