PHP Classes
elePHPant
Icontem

File: get_redirect.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Schroetter Christian  >  PHP Curl HTTP Wrapper  >  get_redirect.php  >  Download  
File: get_redirect.php
Role: Example script
Content type: text/plain
Description: Sample file
Class: PHP Curl HTTP Wrapper
Send HTTP requests with Curl and cache the results
Author: By
Last change:
Date: 0 years ago
Size: 1,311 bytes
 

Contents

Class file image Download
<?php
   
include('./curl.wrapper.php');

   
$curl = new CCurlWrapper();
    if(
$curl->InitEx() === false)
        die(
'Unable to init the CURL library' . "\n");

   
// request
   
$curl->Exec('http://www.artetfenetres.com/agences/recherche-de-revendeur/adherent/cm00015.html');

    echo
'HTTP Code: ' . $curl->GetReturnCode() . "\n";

   
$i_ft = $curl->GetFileTime();
    if(
$i_ft!= -1)
        echo
'File time: ' . $i_ft . "\n";
    else
        echo
'File time: Unavailable' . "\n";

    echo
'Total time: ' . $curl->GetTotalTime() . "\n";
    echo
'DNS Resolve time: ' . $curl->GetNameLookupTime() . "\n";
    echo
'Connect time: ' . $curl->GetConnectTime() . "\n";
    echo
'Pre-transfer time: ' . $curl->GetPreTransferTime() . "\n";
    echo
'Start transfer time: ' . $curl->GetStartTransfertTime() . "\n";

   
$redir_count = $curl->GetRedirectCount();
    echo
'Number of redirection: ' . $redir_count . "\n";
    if(
$redir_count > 0)
    {
        echo
"\t" . 'Final URL: ' . $curl->GetEffectiveUrl() . "\n";
        echo
"\t" . 'Redirection time: ' . $curl->GetRedirectTime() . "\n";
    }

    echo
'Upload size: ' . $curl->GetSizeUpload() . "\n";
    echo
'Upload speed: ' . $curl->GetSpeedUpload() . "\n";

    echo
'Download size: ' . $curl->GetSizeDownload() . "\n";
    echo
'Download speed: ' . $curl->GetSpeedDownload() . "\n";

    echo
'Content type: ' . $curl->GetContentType() . "\n";
?>