PHP code example of deweppro / client

1. Go to this page and download the library: Download deweppro/client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

deweppro / client example snippets


 declare(strict_types=1);

tp();

$client->setUrl('https://localhost/test', ['a' => 1])
    ->setTimeout(10)
    ->sslVerify(true)
    ->setUserAgent('TestUserAgent');

$client->getHeaders()
    ->setContentType('text/json')
    ->setKeepAlive(10)
    ->setBasicAuth('login', 'pass');

$response = $client->post(
    [
        'test' => [
            'test'  => 'hello',
            'test2' => 'hello',
        ],
    ]
)->exec()->getResponse();

$info = $response->getInfo();
var_export($info);

$parsedResp = $response->getBody();
var_export($parsedResp);

$rawResp = $response->getBody(true);
var_export($rawResp);

$xml = $response->asXml(
    [
        'x' => 'http://xml.localhost/type/x',
    ]
);
var_export($xml);