PHP - Like A Page On Facebook With A Checkbox?
Hi guys,
I was wondering if it is possible to like a page on facebook through a checkbox, instead of using the FB like function/script. In other words; people fill out a form and can check the box if they like the page, such as: Code: [Select] <?php if (isset($_POST['form'])) { if (isset($_POST['facebook_checkbox'])) { //like page } else{ //don't like } } ?> <form action="<? $_SERVER['PHP_SELF'];?>" method="post"> <input type="checkbox" id="facebook_checkbox" name="facebook_checkbox" /> <input type="submit" name="form" /> Is there any possibility to do that? Thanks in advance. Similar TutorialsHi every one I want to share a page content(or an article) into my facebook page via php . How should I do that ? Thanks I am trying to allow a user to proceed to another page but only after a user has clicked a Facebook like button and a check has been done to check if the currently logged in user has liked the specific Facebook Page. How can I go about this? Thanks in advance Hello every one i need your help please about this i would like to add this tabs to my facebook fan page i got App allowing me to put php coding or html but i need when some one add his info and click on submit i receive it at my email so can any 1 here help me or tell me what shall i do ? i newbie and hope to get your help guys please database.php First, I will select checkbox then click generate report then it displays the items with download link Then i click download link to download the selected checkbox values in pdf I want to download the selected checkbox items by clicking download link Now i am getting all check box items in the pdf download How to download only the selected check box items Code: [Select] <?php session_start(); $_SESSION['pidd'] = 2; $sessvar = $_SESSION['pidd']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> <style type="text/css" media="print"> DIV#noprint{visibility:hidden;} INPUT#printbutt{visibility:hidden;} #downloadlink{visibility:hidden;} </style> <script type="text/javascript"> function gen() { var st1=document.getElementById("ckbox1").checked; var st2=document.getElementById("ckbox2").checked; var st3=document.getElementById("ckbox3").checked; var st4=document.getElementById("ckbox4").checked; if(st1 == true) { document.getElementById('g1').style.display = 'block'; } if(st2 == true) { document.getElementById('g2').style.display = 'block'; } if(st3 == true) { document.getElementById('g3').style.display = 'block'; } if(st4 == true) { document.getElementById('g4').style.display = 'block'; } document.getElementById('p_info').style.display = 'none'; document.getElementById('histree').style.display = 'none'; document.getElementById('insurence').style.display = 'none'; document.getElementById('billin').style.display = 'none'; } function showuser() { document.getElementById('g1').style.display = 'none'; document.getElementById('g2').style.display = 'none'; document.getElementById('g3').style.display = 'none'; document.getElementById('g4').style.display = 'none'; var str1=document.getElementById("ckbox1").checked; var str2=document.getElementById("ckbox2").checked; var str3=document.getElementById("ckbox3").checked; var str4=document.getElementById("ckbox4").checked; if(str1 == true) { document.getElementById('p_info').style.display = 'block'; } else document.getElementById('p_info').style.display = 'none'; if(str2 == true) { document.getElementById('histree').style.display = 'block'; } else document.getElementById('histree').style.display = 'none'; if(str3 == true) { document.getElementById('insurence').style.display = 'block'; } else document.getElementById('insurence').style.display = 'none'; if(str4 == true) { document.getElementById('billin').style.display = 'block'; } else document.getElementById('billin').style.display = 'none'; } function checkByParent(aId, aChecked) { var collection = document.getElementById(aId).getElementsByTagName('INPUT'); for (var x=0; x<collection.length; x++) { if (collection[x].type.toUpperCase()=='CHECKBOX') collection[x].checked = aChecked; } } </script> </head> <body> <div id="main_content"> <div id="left"> <div id="noprint"> <h4>Patient Report</h4> <a id="check_all" href="#" style="text-decoration:none" onClick="checkByParent('checkboxes', true); return false;">check all</a> <a id="uncheckall" href="#" style="text-decoration:none" onClick="checkByParent('checkboxes', false); return false;">uncheck all</a> <br> <br> <form method="post" name="myform" action=""> <div id="checkboxes"> <div id="cb_id1"> <input id="ckbox1" name="cbox1" type="checkbox" <? if(isset($_REQUEST['cbox1'])) echo 'checked="checked"' ; ?> value="p_info" /> Patient Info </div> <div id="cb_id2"> <input id="ckbox2" name="cbox2" type="checkbox" <?php if(isset($_REQUEST['cbox2'])) echo 'checked="checked"' ; ?> value="histree" /> History </div> <div id="cb_id3"> <input id="ckbox3" name="cbox3" type="checkbox" <?php if(isset($_REQUEST['cbox3'])) echo 'checked="checked"' ; ?> value="insurance" /> Insurence </div> <div id="cb_id4"> <input id="ckbox4" name="cbox4" type="checkbox" <?php if(isset($_REQUEST['cbox4'])) echo 'checked="checked"' ; ?> value="billin" /> Billing </div> </div> <!--checkboxes div --> <br> <input id="vuprint" name="view" type="button" value="View" onClick="showuser();"> <hr/> <label for="docs"> Documents:<br> <br> </label> <input name="sub" type="button" value="Generate report" onclick="gen();"> <hr/> </form> <input id="printbutt" name="prt" type="button" value="Print" onClick="javascript:window.print();"> </div> <!--No print --> </div> <!--Left div --> <div id="side"> <div id="p_info"> <?php require("db_conn.php"); $pinfo = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='".$sessvar."' "); while($fet = mysqli_fetch_array($pinfo)) { echo "<h4>Patient Info</h4>"; echo "<b>Name: </b>" . $fet["P_Fname"] . " " . $fet["P_Lname"]. "<br>"; echo "<b>Dob:</b> " . date("d-m-Y",strtotime($fet["P_Dob"]))."<br>"; echo "<b>Age:</b> " . $fet["P_Age"]."<br>"; echo "<b>Gender:</b> " . $fet["P_Gender"]."<br>"; echo "<b>Marital Status:</b> " . $fet["P_Mstatus"]."<br>"; echo "<b>Blood: </b>" . $fet["P_Blood"]."<br>"; echo "<b>Height: </b>" . $fet["P_Height"] . $fet["P_Hval"]."<br>"; echo "<b>Weight: </b>" . $fet["P_Weight"] . $fet["P_Wval"]; } ?> </div> <div id="histree"> <?php $his = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='".$sessvar."' "); while($hisrow = mysqli_fetch_array($his,MYSQLI_ASSOC)) { echo "<h4>Patient Histroy</h4>"; echo "<b>P_Idate: </b>" . date("d-m-Y",strtotime($hisrow["P_Idate"]))."<br>"; echo "<b>P_Edate: </b>" . date("d-m-Y",strtotime($hisrow["P_Edate"]))."<br>"; echo "<b>D_Ddate: </b>" . date("d-m-Y",strtotime($hisrow["D_Ddate"])); } ?> </div> <!-- Insurence --> <div id="insurence"> <?php $insu = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='".$sessvar."' "); while($insrow = mysqli_fetch_array($insu,MYSQLI_ASSOC)) { ?> <?php echo "<h4>Insurence</h4>"; echo "<b>P_Isname: </b>" . $insrow["P_Isname"]."<br>"; // echo $insow[""]; } ?> </div> <div id="billin"> <?php $bilrow = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='1' "); while($bill = mysqli_fetch_array($bilrow,MYSQLI_ASSOC)) { ?> <?php echo "<h4>Billing</h4>"; echo "<b>P_Fbill: </b>" . $bill["P_Fbill"]."<br>"; echo "<b>Fees: </b>" . $bill["fees"]; } ?> </div> </div> <!--/side div --> <div id="generatereport"> <div id="g1" style="display:none; clear:both;"> <label for="Gen_reports">Generaterd reports</label> <br /> <br /> <?php $pinfo = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='1' "); while($fet = mysqli_fetch_array($pinfo,MYSQLI_ASSOC)) { $new_dob = date("d-m-Y",strtotime($fet["P_Dob"])); ?> <?php echo "<h4>Patient Info</h4>"; echo "<b>Patient Id:</b> ". $fet["P_Id"]."<br>"; echo "<b>Name:</b> " . $fet["P_Fname"] . " " . $fet["P_Lname"]."<br>"; echo "<b>Dob:</b> " . $new_dob ."<br>"; echo "<b>Age:</b> " .$fet["P_Age"]."<br>"; echo "<b>Gender:</b> " . $fet["P_Gender"]."<br>"; echo "<b>Marital Status:</b> " . $fet["P_Mstatus"]. "<br>"; echo "<b>Blood:</b> " . $fet["P_Blood"] . "<br>"; echo "<b>Height:</b> " . $fet["P_Height"] . $fet["P_Hval"]. "<br>"; echo "<b>Weight:</b> " . $fet["P_Weight"] . $fet["P_Wval"]. "<br>"; } echo "*************************************************************************************************************************"; ?> </div> <div id="g2" style="display:none"> <?php $his = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='1' "); while($secrow = mysqli_fetch_array($his,MYSQLI_ASSOC)) { echo "<h4>Patient Histroy</h4>"; echo "<b>P_Idate:</b> " . date("d-m-Y",strtotime($secrow["P_Idate"])) ."<br>"; echo "<b>P_Edate:</b> " . date("d-m-Y",strtotime($secrow["P_Edate"])) ."<br>"; echo "<b>D_Ddate:</b> " . date("d-m-Y",strtotime($secrow["D_Ddate"])) ."<br>"; } echo "*************************************************************************************************************************"; ?> </div> <div id="g3" style="display:none"> <?php $insu = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='1' "); while($insrow = mysqli_fetch_array($insu,MYSQLI_ASSOC)) { echo "<h4>Insurence</h4>"; echo "<b>P_Isname:</b>" . $insrow["P_Isname"]."<br>"; } echo "*************************************************************************************************************************"; ?> </div> <div id="g4" style="display:none"> <?php $bilrow = mysqli_query($mysqli,"SELECT * FROM patient_datas WHERE P_Id='1' "); while($bill = mysqli_fetch_array($bilrow,MYSQLI_ASSOC)) { echo "<h4>Billing</h4>"; echo "<b>P_Fbill:</b> " . $bill["P_Fbill"]."<br>"; echo "<b>Fees:</b> " . $bill["fees"]; } ?> </div> <?php $infochk = 'p_info'; $hischk = 'histree'; $insuchk = 'insurance'; $billchk = 'billin'; ?> <a id="downloadlink" href="download_pdf2.php?info=<?php if(isset($infochk)) echo $infochk; ?>&hist=<?php if(isset($hischk)) echo $hischk; ?>&insu=<?php if(isset($insuchk)) echo $insuchk; ?>&billin=<?php if(isset($billchk)) echo $billchk; ?>">Download</a> </div> <!--generate report --> </div> <!--/main_coontent --> </body> </html> Here is my code below. What I’m having a problem with is trouble to find how to sticky my checkbox and get to the confirmation page after clicking the submit input. I also need on the confirmation page to list what fields are not filled in.
<head> <meta http-equiv="Content-Type"content="text/html; charset=utf-8' /> <title>Assignment 4</title> <style type="text/css" title="text/css" media="all"> </style> </head> <div align="center"> <img src="nba2k20cover.jpg" alt="nba2k20 cover" width="616" height="353" /> <br> <br> <?php include('header.php'); ?> <h4> Hosted by: Zang Thao</h4> <h5> You are required to complete every field to your best!</h5> <body> <?php $name = $_POST['name']; $comments = $_POST['comments']; $gender = $_POST['gender']; $email = $_POST['email']; $league = $_POST['league']; $submit = $_POST['submit']; $monthsarray = array("Month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); $days = range(1,31); $daysdefault = array ('Day'); $daysarray = array_merge($daysdefault, $days); $years = range(2002,1910); $yearsdefault = array ('Year'); $yearsarray = array_merge($yearsdefault, $years); ?> <form name ="fbForm" id="fbForm" action="<?php if(($errors = NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')) { echo "handle.php"; $submit = true; } else { echo "index.php"; } ?>" method="post"> <fieldset><legend>Fill out the registration form below:</legend> <?php if(($_POST['name'] == NULL) && ($_SERVER['REQUEST_METHOD'] == 'POST')) { echo "<b>Please enter a name!</b>"; } ?> <p><label>Name: <input type="text" name="name" size="20" maxlength="40" value="<?php echo $_POST['name']; ?>" /></label></p> <?php if($_POST['email'] == NULL) { echo "<b>Please enter your email!</b>"; } ?> <p><label>Email Address: <input type="text" name="email" size="40" maxlength="60" value="<?php echo $_POST['email']; ?>" /></label></p> <?php if($_POST['gender'] == NULL) { echo "<b>Please select your gender!</b>"; } ?> <p><label for="gender">Gender:</label><input type="radio" name="gender" value="M"<?php if($_POST['gender'] == "M") { echo "checked"; } ?> /> Male<input type="radio" name="gender" value="F" /> Female</label></p> <?php if($_POST['month'] == NULL) { echo "<b>Please enter a birthday!</b>"; } ?> <p><label>Birth Date: <select name="month"> <?php foreach ($monthsarray as $value) { if($_POST['month'] == $value) { $isselected = "selected"; } else { $isselected = ""; } echo "<option value='$value' $isselected>$value</option> \n"; } ?> </select> <select name="day"> <?php foreach ($daysarray as $value) { if($_POST['day'] == $value) { $isselected = "selected"; } else { $isselected = ""; } echo "<option value='$value' $isselected>$value</option> \n"; } ?> </select> <select name="year"> <?php foreach ($yearsarray as $value) { if($_POST['year'] == $value) { $isselected = "selected"; } else { $isselected = ""; } echo "<option value='$value' $isselected>$value</option> \n"; } ?> </select></label></p> <?php if($_POST['league'] == NULL) { echo "<b>Please select a league!</b>"; } ?> <p><label for="league">Choose your league:</label><input type="checkbox" name="league" value="A"<?php if($_POST['opt'] == "A") { echo "checked"; } ?> /> A <input type="checkbox" name="league" value="B" <?php if($_POST['opt'] == "B") { echo "checked"; } ?>/> B <input type="checkbox" name="league" value="C" <?php if($_POST['opt'] == "C") { echo "checked"; } ?>/> C <input type="checkbox" name="league" value="D" <?php if($_POST['opt'] == "D") { echo "checked"; } ?>/> D</p> <?php if($_POST['comments'] == NULL) { echo "<b>Write down your questions/concerns if you don't have any write N/A!</b>"; } ?> <p><label>Questions/Concerns: <textarea name="comments" rows="3" cols="40"><?php echo $_POST['comments']; ?></textarea></label></p> </fieldset> <?php if ($submit) { echo"<script>document.getElementById('fbForm').submit();</script> "; } ?> <p align="center"><input type="submit" name="submit" value="REGISTER!" /></p> </form> <?php include('footer.php'); ?> </body> </html>
On Facebook, when you click on "view friends" on one of your friends' profile, a window pops up. Is that made with PHP? Or is it flash or something? In case it's PHP, what would you use to make something like that? Thank you in advance! Hi Guys, I am using the PHP Facebook code with my app; <?php $app_id = ""; $app_secret = ""; $my_url = ""; session_start(); $code = $_REQUEST["code"]; if(empty($code)) { $_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection $dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . "&state=" . $_SESSION['state']; echo("<script> top.location.href='" . $dialog_url . "'</script>"); } if($_REQUEST['state'] == $_SESSION['state']) { $token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . "&client_secret=" . $app_secret . "&code=" . $code; $response = @file_get_contents($token_url); $params = "user_questions"; parse_str($response, $params); $graph_url = "https://graph.facebook.com/me?access_token=" . $params['access_token']; $user = json_decode(file_get_contents($graph_url)); echo("Hello " . $user->name); } else { echo("The state does not match. You may be a victim of CSRF."); } ?>() However I am having issues with the permissions, I can only ever get it to ask for "Yout basic info" when it needs to ask for more than that. Any ideas why? Cheers in advance. I'm trying to add Facebook connect to my new app, but I'm not sure where to really start. I looked through a lot of the facebook documentation, but I haven't been able to find any really good implementation suggestions. I just want basic functionality. Hey guys, i'm creating a facebook clone. Almost there, got the main/basic features all done, however i've got one piece of code which is really bugging me, don't worry about it being messy and horribley coded. I will be improving and optimising it every chance i get once i've got this down. it's on the main page, i want it to display all recent status' that have been made, i can display them however i think i've bugg'd the SQL somewhere and it's driving my crazy, any help would be greatly appriciated Thanks Code: [Select] <?php $sql = mysql_query("SELECT * FROM statuses ORDER BY id DESC"); $sql = mysql_query("SELECT * FROM statuses LEFT JOIN users ON statuses.userid = users.id"); while ($row = mysql_fetch_assoc($sql)) { $status_id = $row['id']; $status = $row['status']; $time_posted = $row['time_posted']; $sql2 = mysql_query("SELECT username,avatar_url FROM users WHERE id=$userid LIMIT 1"); while ($row2=mysql_fetch_array($sql)){ $usernamestatus = $row2['username']; $avatar_url = $row2['avatar_url']; echo '<div id="content">'; echo "<img src='/photos/$usernamestatus/$avatar_url' height='50px' width='50px' />"; echo "<a href=\"profile.php?id=$userid\">". $usernamestatus ."</a>"; echo "<br />"; echo $status; echo " <span class=x><a href=delete_status.php?id=$status_id>x</a></span>"; echo "<br />"; echo time_ago($time_posted); echo "<br />"; echo "<br />"; echo "</div>"; } } } ?> I dont no if this should even go here but here it goes. I created a blog were each blog post is veiwed on the same page in regards to the id passed to it (as standard). What i really need to do is incorporate the facebook comment box onto the page but... it only relates to the document itself rather than it's dynamic content. Hi there! First, i must say that i have no php knowledge, maybe a 1% Here is what i want to do: I have wordpress, with a plugin called Facebook connect, it has a cool feature where you can invite your facebook friends, it looks like this: http://dailyerz.com/login/?fbconnect_action=invite And i am also using cubepoints, a plugin that rewards users with points. I want to reward users for every user they invite. From the cube points docs http://techcube.net/docs/1.3/docs.html i got this: Quote The following code will add 10 points to the current logged in user. If no user is logged in, no points will be added. You may input negative number to subtract points. <php if( function_exists('cp_alterPoints') && is_user_logged_in() ){ cp_alterPoints(cp_currentUser(), 10); } ?> and the invite.php of facebook connect looks like this: <?php get_header(); $fb_user = fb_get_loggedin_user(); ?> <div style="padding:20px;" > <?php if(FBCONNECT_CANVAS=="web") : ?> <fb:serverfbml style="width: 100%;"> <script type="text/fbml"> <fb:fbml> <?php endif; ?> <fb:request-form action="<?php echo get_option('siteurl'); ?>" method="GET" invite="true" type="<?php echo get_option('blogname');?>" content="<?php echo get_option('blogname')." : ".get_option('blogdescription'); ?> <fb:req-choice url='<?php echo get_option('siteurl'); ?>' label='<?php _e('Become a Member!', 'fbconnect') ?>' /> " > <fb:multi-friend-selector rows="5" email_invite="false" cols="3" showborder="false" actiontext="<?php _e('Invite your friends to Dailyerz.', 'fbconnect') ?>"> </fb:request-form> <?php if(FBCONNECT_CANVAS=="web") : ?> </fb:fbml> </script> </fb:serverfbml> <?php endif; ?> </div> <?php get_footer(); ?> Any idea on how to make this work? Do i have to create a Facebook App? Thanks! Hi all, I am a beginner for PHP. I created a site & now I want to add a wall post to my Facebook Page. This post should be posted via PHP when I add a post to my site, without manually adding that on Facebook Page. I referred Facebook Developer documentations, but those are really mess for me. I really don't want this to do with php-sdk or any other. I want to do this manually. Thanks Hi I am using facebook auth but email id not fetching from facebook login please help me why is happening? I am going to use this script http://www.gayadesign.com/diy/snotify-easy-notifications-in-jquery/ but I wanted to know how exactly would I make it work like facebook does? What steps would I take to show the other user the notification rather than showing me, the sender it? Hey guys, Been trying to get my head around curl over the past month, I need help with loading one of Facebook's Applications. I need the script to: 1) Log into Facebook. 2) Load up the application. 3) Load up the application's iFrame. I've got steps 1 + 2 down, so it logs into Facebook and loads up the application alright, but when it comes to loading up the specific application's iframe, it re-directs me to log in again. I am 99% sure it's something to do with cookies because if you log in locally and load up the iframe url it has no problem loading up the app. (Iframe URL: http://mobsters-fb-apache-dynamic-lb.playdom.com/prod_facebook/facebook/mobsters_v1/facebook_iframe.php?track=bookmark) Here is my current code: (Running it in apache) And also I am really new to curl and am pretty much learning on the go so please excuse any obvious errors $Email = strip_tags(str_replace(' ', '', $_POST['email'])); $Password = strip_tags(str_replace(' ', '', $_POST['password'])); $MobstersURL = "http://apps.facebook.com/mobstersapp/index.php?track=bookmark&ref=bookmarks&count=0"; $FBlogin = 'https://www.facebook.com/login.php?login_attempt=1'; $Data = 'charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=vuCfh&locale=en_US&email='.urlencode($Email).'&pass='.urlencode($Password).'&default_persistent=0&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=vuCfh'; $Cookie = "cookie.txt"; $fp = fopen($Cookie,'wb'); $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7"; //login to facebook $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$FBlogin); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_COOKIEFILE, $Cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $Cookie); curl_setopt($ch, CURLOPT_REFERER, $FBlogin); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $Data); $Excecute = curl_exec($ch); //echo $Excecute; //load up mobsters then display it curl_setopt($ch, CURLOPT_URL,$MobstersURL); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_REFERER, "http://www.facebook.com/?ref=logo"); curl_setopt($ch, CURLOPT_COOKIEFILE, $Cookie); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $LoadMobsters = curl_exec($ch); echo $LoadMobsters; //load up mobsters in iframe THIS IS WHERE I'M STUCK curl_setopt($ch, CURLOPT_URL, "http://mobsters-fb-apache-dynamic-lb.playdom.com/prod_facebook/facebook/mobsters_v1/facebook_iframe.php?track=bookmark"); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_COOKIEFILE, $Cookie); curl_setopt($ch, CURLOPT_REFERER, "http://apps.facebook.com/mobstersapp/index.php?track=bookmark&ref=bookmarks&count=0"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 1); $Load_iFrame = curl_exec($ch); echo $Load_iFrame; // This is where I noticed it wasn't working since instead of loading up the iframe, it brought me back to facebook to log in. So yeah I need some help in loading up the iframe since that is where I need to grab important data. Any help would be much appreciated, and yes, I've been to http://php.net/manual/en/book.curl.php a billion times which is why I've come here where the pro's are for help Thanks. Hi, Is anyone here familiar with the Facebook API? My boss wants people to be able to share their store with their friends on Facebook from within the stores admin panel. He wants the following. 1) Display all friends with a checkbox next to each name. 2) Check the friends you want to inform about your store. 3) Post a message on checked friends wall. It sounds simple. The problem is the friends selection screen. Some of my friends on Facebook have 1000 friends. Obviously listing all of them is inpractical. Ideally I need a search box to limit the friends that display and make it easy to find who you are looking for. Does something like this already exist? Does it have a name? Hello. I have a facebook like button. It is wrapped in an iFrame. What I would like to create is a Form that when the user clicks the submit button the action is to process the Facebook like button. So pressing my button presses the facebook like button as well. Why? Because I would like to keep track of users that click the like button. This is an example of the like button. <iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.likethis.com&send=false&layout=standard&width=450&show_faces=true&action=like&colorscheme=light&font&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe> I got this piece of code:
<div class="tbl tbl-facebook" id="<? echo $site->facebook;?>"> Following is the code that works fine if I am passing `/pageid/feed` to `facebook->api`, but when I change it to upload the image directly to my Facebook FAN PAGE photo album, it will not work. Kindly let me know what I am doing wrong in the following code: // Works fine $status = $facebook->api("/406221796071956/feed", 'post', $attachment); // Does not work $status = $facebook->api('/196878530339618/photos', 'post', $attachment); # Full Source Code: [Select] <?php require 'src/facebook.php'; $app_id = "364900470214655"; $app_secret = "xxxx"; $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $app_secret, 'cookie' => true, 'fileUpload' => true, )); $user = $facebook->getUser(); if(($facebook->getUser())==0){ header("Location:{$facebook->getLoginUrl(array('req_perms' => 'photo_upload,user_status,publish_stream,user_photos,offline_access,manage_pages'))}"); exit; } else { $accounts_list = $facebook->api('/me/accounts'); echo "i am connected"; } $valid_files = array('image/jpeg', 'image/png', 'image/gif'); // To get the page access token to post as a page foreach($accounts_list['data'] as $account){ if($account['id'] == 194458563914948){ // my page id =123456789 $access_token = $account['access_token']; echo "<p>Page Access Token: $access_token</p>"; } } // Posting to the page wall if(isset($_FILES) && !empty($_FILES)){ $folder = "pak/".$_FILES['pic']['name']; // Getting the path of the folder $fold = 'http://radiations3.com/facebook/'.$folder; // URL Path to folder echo $fold."<br>"; if(move_uploaded_file($_FILES['pic']['tmp_name'], $folder)){ # Upload photo here $img = realpath($_FILES["pic"]["tmp_name"]); $album_id = '406221796071956'; $attachment = array( 'message' => $_POST['textfield'], 'source' => $fold, 'aid' => $album_id, 'no_story' => 1, 'access_token' => $access_token ); $status = $facebook->api("/196878530339618/photos", 'post', $attachment); } else{ echo 'Only jpg, png and gif image types are supported!'; } } ?> <body> <!-- Form for uploading the photo --> <div class="main"> <p>Select a photo to upload on Facebook Fan Page</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data"> <p>Select the image: <input type="file" name="pic" /> <br /> <label>Description <input type="text" name="textfield" id="textfield" /> </label> </p> <p><input class="post_but" type="submit" value="Upload to my album" /></p> </form> </div> </body> |