Created
July 15, 2020 10:08
-
-
Save marcbln/cae505a0b5a90a39a16714d47f5afdbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 07/2020 test for creating a cli script to convert bootstrap3 to bootstrap4 | |
include(__DIR__ . "/../vol/www/vendor/autoload.php"); | |
use GuzzleHttp\Client; | |
$url = 'http://upgrade-bootstrap.bootply.com/'; | |
$formData = [ | |
'convertStructure' => true, | |
'source' => '<div class="container-fluid"> | |
<div class="row"> | |
<div class="col-sm-3 col-sm-push-3" style="background-color:lavender;">1 .col-sm-3</div> | |
<div class="col-sm-3 col-sm-pull-3" style="background-color:lavenderblush;">2 .col-sm-3</div> | |
<div class="col-sm-3 col-sm-push-3" style="background-color:lightyellow;">3 .col-sm-3</div> | |
<div class="col-sm-3 col-sm-pull-3" style="background-color:lightblue;">4 .col-sm-3</div> | |
</div> | |
</div>', | |
]; | |
$client = new Client(); | |
$response = $client->post($url, [ | |
GuzzleHttp\RequestOptions::FORM_PARAMS => $formData | |
]); | |
$jsonResponse = ''; | |
while(!$response->getBody()->eof()) { | |
$jsonResponse.= $response->getBody()->read(256); | |
} | |
$converted = json_decode($jsonResponse, true)['result']; | |
echo "\n\n\n$converted\n\n\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment