EasyCFM.COM ColdFusion Forums / PHP to CFML / Help turn PHP code into CF, DESPERATE

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Help turn PHP code into CF, DESPERATE

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

charmed0rz
07-29-2006 @ 8:25 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 272
Joined: Jun 2004

PLEASE someone help me turn this PHP code into Coldfusion. I hired someone to create this for me in COldfusion, then they sent me this PHP code and dissapeared. I have no money to pay someone again.



<?
    $base_url = 'http://www.imdb.com';
   $search_path = '/find?s=tt&q=';

   $request = $_REQUEST['movie'];

   if (empty($request)) {
        echo 'Movie parameter is empty.';
        die();
    }


    // do the searching
    // just download result of
    // http://www.imdb.com/find?s= face="Courier New,Courier,Times New Roman" color="#0000ff">tt&q=query
   $contents = file_get_contents($base_url.$search_path.urlencode($request));

   if (!empty($contents)) {

        // by this regexp tries to extract movie link
        if (preg_match('|<b>
Titles\s*\(Exact Matches\)\s*</b>[\s\S]*?<a\s*href=["\']?([^"\']+)["\']?|i'
                       , $contents
                        , $match)) {

            // if we extracted movie link we add to link "plotsummary"
            // and download review
            $data = file_get_contents($base_url.$match[1].'plotsummary');

           // tries to extract review body from html page
            if (preg_match('|<p class=["\']?plotpar["\']?>
([\s\S]+?)</p>|i'
                , $data
                , $m)) {

                $review = $m[1];
                // shows $review
                echo '<b>Review for movie"'.$request.'":</b><br>'.$review;

            }
            else {
                echo 'No review for movie: '.$request;
            }
        }
        else {
                echo 'No review for movie: '.$request;
        }

    }
    else {
        echo 'No review for movie: '.$request;;
    }
?>



I've gotten this far...




This message was edited by charmed0rz on 7-29-06 @ 8:41 PM


Website Designed and Developed by Pablo Varando.