'How to convert Goutte response to json
so im trying to scrape data from this url here, basically i input some data into the form and the form returns a table, in which i have to collect all the data into a json output into something like this.
However i cant seem to convert the response into a json output as it's always returing it in text. I tried to encode and decode the text into json but it does not work.
<?php
require 'vendor/autoload.php';
use Goutte\Client;
$client = new Client();
$crawler = $client->request('GET', 'https://search.ipaustralia.gov.au/trademarks/search/advanced');
// $crawler = $client->click($crawler->selectLink('Sign in')->link());
$form = $crawler->selectButton('Search')->form();
$crawler = $client->submit($form, ['wv[0]' => 'abc']);
// $header_car = $crawler->filter("resultsTable")->text();
// $output = $crawler->filter('#resultsTable');
$output = $crawler->filter('#resultsTable')->each(function ($node) {
$response = $node->text();
var_dump($response);
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


