grabing data from url
        Posted  
        
            by Syom
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Syom
        
        
        
        Published on 2010-03-20T18:02:07Z
        Indexed on 
            2010/03/20
            18:11 UTC
        
        
        Read the original article
        Hit count: 317
        
php
i have a task - i must grab some data from the URL. the link is http://cba.am. the data, i want to take, are in the some table, and i have the only one identifier, to reach my wanted data, it's the word "usd", which writes in that table(html)! i've written the following script, and it works! but i never heard how more experienced programers do such things, so i want to hear your comments.
here is script
<?php
    $str = file_get_contents("http://cba.am/");
    $key_usd = "USD";
    $sourse_usd_1 = explode($key_usd,$str);
    $usd1 = $sourse_usd_1[2];
    $sourse_usd_2=explode(">",$usd1);
    $usd2 = $sourse_usd_2[4];
    $sourse_usd_3=explode("<",$usd2);
    $usd = $sourse_usd_3[0];
?>
sorry for poor english:)
© Stack Overflow or respective owner