/**
 * NOT YET FULLY SUPPORTED!!
 * (PHP 4 &gt;= 4.0.4, PHP 5)<br/>
 * Get information regarding a specific transfer
 * @link http://php.net/manual/en/function.curl-getinfo.php
 * @param resource $ch
 * @param int $opt [optional] <p>
 * This may be one of the following constants:
 * <b>CURLINFO_EFFECTIVE_URL</b> - Last effective URL
 * @return mixed If <i>opt</i> is given, returns its value as a string.
 * Otherwise, returns an associative array with the following elements
 * (which correspond to <i>opt</i>), or <b>FALSE</b> on failure:
 * "url"
 * "content_type"
 * "http_code"
 * "header_size"
 * "request_size"
 * "filetime"
 * "ssl_verify_result"
 * "redirect_count"
 * "total_time"
 * "namelookup_time"
 * "connect_time"
 * "pretransfer_time"
 * "size_upload"
 * "size_download"
 * "speed_download"
 * "speed_upload"
 * "download_content_length"
 * "upload_content_length"
 * "starttransfer_time"
 * "redirect_time"
 * "certinfo"
 * "request_header" (This is only set if the <b>CURLINFO_HEADER_OUT</b>
 * is set by a previous call to <b>curl_setopt</b>)
 */
function curl_getinfo(\Purl $ch, $opt = 0)
{
    return $ch->getInfo($opt);
}
Exemple #2
0
			</div>
			<p id="send-wrap">
				<button type="submit">Send</button>
			</p>
		</form>
		<?php 
if ($_POST['url']) {
    /* Construct params */
    $request_params = array();
    if ($_POST['param-keys']) {
        foreach ($_POST['param-keys'] as $key) {
            $request_params[$key] = current($_POST['param-vals']);
            next($_POST['param-vals']);
        }
    }
    $purl = new Purl();
    $purl->url = $_POST['url'];
    $purl->method = $_POST['method'];
    $purl->follow_redirects = isset($_POST['follow_redirects']);
    $purl->request_params = $request_params;
    $response = $purl->dispatch();
    ?>
		<p>Response:</p>
<pre>
<?php 
    foreach ($response['headers'] as $header_name => $header_value) {
        echo '<span class="header_name">' . $header_name . ($header_value ? ':' : '') . '</span>' . '<span class="header_value">' . $header_value . '</span><br />';
    }
    echo '<br /><br />' . htmlspecialchars($response['body']);
    ?>
</pre>