Jump to content

cURL help


TheLikePlanet

Recommended Posts

Hello, I'm making a site similar to http://thelikeportal.com, and I need a little help.  I'm using cURL to do this, but I'm running into a problem.  When you create a page on facebook, 2 random strings are generated (post_form_id, and fb_dtsg).  I don't know how to get these 2 strings from facebook.  Here's what I currently have:

     <?php
     
     //$like = $_POST['like'];
     //$dashed_like = str_replace(" ", "-", $like);
     //$desc = $_POST['desc'];
     $ckfile = tmpfile();    
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "http://www.facebook.com/pages/create.php");
        $useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3";
        curl_setopt($ch, CURLOPT_USERAGENT, $useragent);                                                      
                curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile);                                                
            curl_setopt ($ch, CURLOPT_POST, 1);                                                               
                curl_setopt ($ch, CURLOPT_REFERER, "http://www.facebook.com/pages/create.php");
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_POSTFIELDS, "post_form_id=". $post_form_id ."&fb_dtsg=". $fb_dtsg ."&is_community=1&page_name=". $page_name ."");
                          $server_response = curl_exec($ch);
                parse_str($server_response);
                echo $server_response ."\n";
                sleep(9999);
                
                
                ?>

 

Thanks,

TheLikePlanet

Link to comment
https://forums.phpfreaks.com/topic/204465-curl-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.