View Single Post
ישן 19-06-07, 00:16   # 1
RS324
תודה על תרומתך.
 
מיני פרופיל
תאריך הצטרפות: May 2006
הודעות: 3,173

RS324 לא מחובר  

והזוכה לאתגר הוא

elbaz.maor

מזל טוב, מהיום אתה ירוק למשך שבועיים.
את הקוד שלך נפרסם בהמשך.


PHP קוד:
<?php

$www  
$_GET['url'];
$css  file_contents('http://client.alexa.com/common/css/scramble.css');
$html file_contents('http://www.alexa.com/data/details/traffic_details?url='.$www);

// לקיחת תוכן הדף באמצעות פונקציות הספרייה CURL 

function file_contents($url)
{
    
$curl curl_init($url);
            
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
    
$html curl_exec($curl);
            
curl_close($curl);
    return 
$html;
}

// חיפוש שם הקלאס בקובץ הCSS 

function search($match)
{
    global 
$css;
    
    if(
strpos($css,$match[1]) === false)
    {
        return 
$match[2];
    }
}

// חיפוש אחר מיקום הדירוג 

preg_match('/<span class="descBold">(.*?)-->(.*?)<\/span><br>/',$html,$html2);

// החלפת הקלאסיים הנעלמים במחרוזת ריקה 

$string preg_replace_callback('/<span class="([a-z0-9]{4})">([0-9,]+)<\/span>/','search',$html2[2]);

// הדפסת התוצאה הסופית 

print $string;

?>
  Reply With Quote