PHP code example of ehough / curly

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

    

ehough / curly example snippets


$url = new ehough_curly_Url('foo://username:[email protected]:8042/over/there?name=ferret#nose');

$url->getAuthority();      // [email protected]:8042
$url->getFragment();       // nose
$url->getHost();           // example.com
$url->getPath();           // /over/there
$url->getPort();           // 8042
$url->getQuery();          // name=ferret
$url->getQueryVariables(); // array('name' => 'ferret');
$url->getScheme();         // foo
$url->getUser();           // username

$url->setFragment('ear');
$url->setHost('ehough.com');
$url->setPath('/paved/walkway');
$url->setPort(99);
$url->setQueryVariables(array('moon' => 'rise', 'sun' => 'set'));
$url->setScheme('teleport');
$url->setUser('melissa:salsa');

echo $url->toString(); // teleport://melissa:[email protected]:99/paved/walkway?moon=rise&sun=set#ear