PHP code example of ahmard / queliwrap

1. Go to this page and download the library: Download ahmard/queliwrap 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/ */

    

ahmard / queliwrap example snippets




use Queliwrap\Client;

Client::get('https://google.com')->execute()
    ->find('ul')->eq(0)
    ->find('li');

use Queliwrap\Client;

try {
    $text = Client::get('https://google.com')->execute()
        ->find('ul')->eq(0)
        ->find('li')
        ->text();
        
    echo $text;
}catch (Throwable $exception){
    echo $exception->getMessage();
}

use Guzwrap\Wrapper\Form;
use Queliwrap\Client;

Client::post(function(Form $form){
    $form->action('http://localhost:8080/rand/guzwrap.php');
    $form->field('name', 'Jane Doe');
    $form->file('image', 'C:\1.jpg');
});

use Guzwrap\Wrapper\Form;
use Queliwrap\Client;

//Login
Client::create()
    ->referer('http://localhost:8000')
    ->withSharedCookie()
    ->form(function (Form $form){
        $form->action('http://localhost:8000/login');
        $form->method('POST');
        $form->input('email', '[email protected]');
        $form->input('password', 1234);
        $form->input('remember_me', 1);
    })->exec();

//View user profile
$queryList = Client::create()
    ->get('http://localhost:8000/users/view')
    ->query(['id' => 2])
    ->withSharedCookie()
    ->execute();

//Find user info
$firstName = $queryList->find('.profile')
    ->find('list-group-item')
    ->eq(0)
    ->text();

echo "First name: {$firstName}";