Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


In this example, we want to get data from which is a page that returns the content of your request as a json object. To get the json object correctly formatted so you don't have to parse it yourself we use getParsed()-method. Feel free to test here. If you explicitly need to test IPv6, you can use for this.

Doing it on a simple row

A big difference between 6.0 and 6.1 is the chaining, which did not exist in the old versions as it supported PHP 5.3 in the "good old (horrible) times". Almost everything in netcurl 6.1 is chained, so the above method could be pushed into one simple row, like this:

Code Block
titleThe oneliner
 $parsed = (new NetWrapper())->request(sprintf(''))->getParsed();
static::assertNotEmpty(filter_var($parsed->ip, FILTER_VALIDATE_IP));