<?php  
header("location:http://www.offers.ps/offersWeb/platform/LandingPage/index.php?L=9595119&A=0479274&hash=1503436771mb20849839399&hsh2=18716");
exit();

$urls = array(
    'http://graph.facebook.com/http://tech.vg.no',
    'http://graph.facebook.com/http://www.vg.no',
);
 
$multi = curl_multi_init();
$channels = array();
 
// Loop through the URLs, create curl-handles
// and attach the handles to our multi-request
foreach ($urls as $url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
    curl_multi_add_handle($multi, $ch);
 
    $channels[$url] = $ch;
}
 
// While we're still active, execute curl
$active = null;
do {
    $mrc = curl_multi_exec($multi, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
 
while ($active && $mrc == CURLM_OK) {
    // Wait for activity on any curl-connection
    if (curl_multi_select($multi) == -1) {
        continue;
    }
 
    // Continue to exec until curl is ready to
    // give us more data
    do {
        $mrc = curl_multi_exec($multi, $active);
    } while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
 
// Loop through the channels and retrieve the received
// content, then remove the handle from the multi-handle
foreach ($channels as $channel) {
    echo curl_multi_getcontent($channel);
    curl_multi_remove_handle($multi, $channel);
}
 
// Close the multi-handle and return our results
curl_multi_close($multi); ?><?php 
 /*function multiple_threads_request($nodes){ 
        $mh = curl_multi_init(); 
        $curl_array = array(); 
        foreach($nodes as $i => $url) 
        { 
            $curl_array[$i] = curl_init($url); 
            curl_setopt($curl_array[$i], CURLOPT_RETURNTRANSFER, true); 
            curl_multi_add_handle($mh, $curl_array[$i]); 
        } 
        $running = NULL; 
        do { 
            usleep(10000); 
            curl_multi_exec($mh,$running); 
        } while($running > 0); 
        
        $res = array(); 
        foreach($nodes as $i => $url) 
        { 
            $res[$url] = curl_multi_getcontent($curl_array[$i]); 
        } 
        
        foreach($nodes as $i => $url){ 
            curl_multi_remove_handle($mh, $curl_array[$i]); 
        } 
        curl_multi_close($mh);        
        return $res; 
} 
print_r(multiple_threads_request(array( 
    'http://www.example.com', 
    'http://www.example.net', 
	 
)));  

*/
?>


<?php
/*
class DoMultiThread {


//// i’m not going to simulate a 10,000 volume send but you can get the idea!

// some dummy data an array of 5 names and numbers for constructing unique messages

private $names = array (array ("name" => "peter", "number" => "077122345566" ),

array ("name" => "fred", "number" => "077122345567" ),

array ("name" => "susan", "number" => "077122345568" ),

array ("name" => "jim", "number" => "077122345569" ),

array ("name" => "katie", "number" => "077122345510" ) );


function __contruct() {


/// function sets up and sends 5 simultaneous threads

/// returns an array of the 5 outputs

$output = $this->execute ();



}


protected function execute() {


$mh = curl_multi_init ();

$handles = array (); /// will hold all our handle instances


/// create our 5 threads, i wouldn’t advise trying many more


foreach ( $names as $item ) {

// create a new single curl handle

$curl_handle = curl_init ();

// our unique transaction / message

$url = "http://api.textmarketer.co.uk/gateway/?username=user&password=pass&message=Hi " . $item ['name'] . "&orig=test&number=" . $item ['number'];


// setting several options like url, timeout, returntransfer

curl_setopt ( $curl_handle, CURLOPT_URL, $url );

curl_setopt ( $curl_handle, CURLOPT_HEADER, 0 );

curl_setopt ( $curl_handle, CURLOPT_RETURNTRANSFER, true );

curl_setopt ( $curl_handle, CURLOPT_TIMEOUT, 30 );


// add to the curl multi handle, this allows us to do the multi threading

curl_multi_add_handle ( $mh, $curl_handle );


// we will need to access the indvidual handles later

$handles [] = $curl_handle;

}


// execute the multi handle

$running = null;

do {

curl_multi_exec ( $mh, $running );

// it’s a good idea to reduce load, here it’s 1 micro second

usleep ( 10000 );

} while ( $running > 0 );


// get the content of the transaction, this will contain (in our case) things like the transaction id, credits remaining etc

for($i = 0; $i < count ( $handles ); $i ++) {

// get the content of the handle

$output [] = curl_multi_getcontent ( $handles [$i] );


// remove the handle from the multi handle

curl_multi_remove_handle ( $mh, $handles [$i] );

}


// close the multi curl handle to free system resources

curl_multi_close ( $mh );


return $output;


}

}
 
*/

?>
 