This page is maintained to keep the documentation smaller when it comes to generic requests that can be used in all wrapper modules. Methods at this page is normally supported by CurlWrapper, NetWrapper, SimpleStreamWrapper.
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. There are however limits in different kind of places with makes requests with the obsolete PHP versions impossible. All autotests are running with PHP 5.6 or higher. PHP 5.4 does not work with autotests anymore, but could still be compatible in rare cases (I really don't know). All wrappers are based on same requests, so regardless if you use the curlWrapper directly or the generic netWrapper, the outcome will be much the same.
getParsed(), getBody(), getHeader(), getCode()
By using getBody(), you can also fetch the data unparsed. Likewise, you can also fetch other data from the request, like for example the returned headers from the server with a getHeader()-method. By running getHeader() without an argument, you'll ge the entire header, so if you'd like to fetch specific header rows, you can add a parameter like the example below:
The most basic request is done with simply using request(). The only argument it actually needs is the URL, and then you can start using the above get-methods to retrieve what you need from the site. There are however a bunch of arguments to use here, including multi-requests (i.e. for curl and the wrappers that supports multiple requests in the same call).
|url||string or array||The only one you need.|
|data||array||Data to include in the request as an array. Formatted as default postdata if nothing else is given.|
GET, POST, PUT, DELETE, HEAD, REQUEST, PATCH
How data is posted in the request. Can be
NORMAL (?var=val&var1=val1), JSON, SOAP, XML, SOAP_XML, RSS_XML
String or array?
As you can see, you can add urls in the format of an array. By doing this you do an important one step up, which transform netcurl very much in a multirequest tool. Referring to the different wrappers it can look like anything from:
Where the multirequet is very simple built. Or if you want to advance into something more complex:
Each time the wrappers get this kind of request it always checks if curl_multi is available before using the simpler methods. So you can use this urllist as a simple array, or associative array.
This is some of the arguments in a associative array.
|headers||Extra headers to include into the request.|
Extra headers to include into the request, but they will restored even if the wrapper is reset between the requests.