PHP - Help With Facebook Share Script, Link Not Displaying Properly.
Hi all,
I'm not great with PHP and I have this one problem that I hope you can help with. I have a script that generates an URL. The output string is $shorturl and displays properly when I echo it using Code: [Select] <?php echo '$shorturl' ?>. However, when I try the following script for a Facebook share button Code: [Select] <fb:share-button> <a name="fb_share" type="button" share_url="<?php echo '$shorturl' ?>" href="http://www.facebook.com/sharer.php" layout="button_count">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script> </fb:share-button> The resulting URL it produces is: http://</?php+echo+%27http%3A%2F%2Fshelb... Any idea's? Thank you! Similar TutorialsI have placed the Facebook LIKE/SHARE buttons on a website using the following:
<div class="fb-like" data-href="http://mysite.com" data-layout="standard" data-action="like" data-show-faces="false" data-share="true" data-width="280px"></div>the LIKE button works fine. the SHARE button works but i cannot seem to customize and of the values such as which image to include. i have the following in my HEAD section but it does nothing. do i need to create an APP and reference the ID? any help is much appreciated <meta property="og:type" content="website" /> <meta property="og:title" content="Can tea make for a happy marriage" /> <meta property="og:url" content="http://mysite.com/index.php" /> <meta property="og:image" content="http://mysite.com/pics/gallery/2.jpg" /> Edited by BuildMyWeb, 28 September 2014 - 05:18 PM. Can somebody please explain how to properly add a Facebook Share button to my site?
It's not simply a matter of generating the button and pasting the code into my pages; in order to ensure that the right information is shared, I also have to add Open Graph metatags.
But the thing that's confusing me is that one of the required Open Graph metatags is this:
<meta property="fb:app_id" content="APP_ID_NUMBER" />Questions 1) Does this mean that I have to register as an app builder before I can add the Share button? If so, why doesn't Facebook say so on the Share button page? 2) When generating the Share button, I am asked for the "URL to share". Does this mean that I have to generate a different Share button for each page? Surely not. 3) I use ShareThis at the moment. Does ShareThis work with Facebook Insights? This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=347238.0 after spending many hours thinking this through and not really getting anywhere, trying to figure out how this site works, so that i can replicate it and make a single image from multiple images that are positioned overlaying with css positioning
the site in question is: http://www.dahippo.c...6360ZZ0ZZ0ZZ0ZZ
it is a type of calculator for an online game, the part that interests me is the image of the ship that is built up from many images
is also uses a php script to place all these images into on image file outputted to html, this is what interests me and i am trying to recreate, like he http://www.dahippo.c...6360ZZ0ZZ0ZZ0ZZ
here is the outputted html:
<html> <head> <meta name="viewport" content="width=device-width, minimum-scale=0.1"> <title>get.php (635x317)</title> </head> <body style="margin: 0px;"> <img style="-webkit-user-select: none; cursor: -webkit-zoom-in;" src="http://www.dahippo.com/bp/ship/get.php?image=4J01Q180O0K0E013C3A3C3A3636360ZZ0ZZ0ZZ0ZZ" width="408" height="204"> </body> </html>what php code used in the get.php script make all these images with css positioning into 1 image? i have asked the site owner, and got no reply :/ I have been trying to replicate the facebook "share" functionality , well actually i was in need of this functionality even before i knew that fb already had it.. I learnt a few things that this can be achieved by using the "Curl" and I also hear that this setting may have been switched in some servers so if anyone can refer me to other options that would always fetch me the - Title- Description- Images for sure I' d be thankful Regards Hi 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'm wondering if anyone can help me find/create a script which allows a preview of a link to be generated? Basically I need a user to be able to simply enter a url and click submit and then a preview of that link will be shown in the form of some text and an image. Very similar to what Facebook does when a user shares a link. I think they use the description tag of the site in general. Can anyone point me in the right direction in doing this? I need to be able to do it in php/javascript alone without the use of jquery or plugins. Hello,
First of thank you for taking your time reading this, I have a question about what is wrong with my webserver. I made a website using PHP on my local WAMP server. I uploaded it to my webserver this morning and as it turns out something like
<?php echo '<p>Hello World</p>'; ?>
gets compiled to
Hello World
'; ?>
I honestly have no idea what I have done wrong and I cant seem to find this anywhere...
Hope to hear for someone soon
Trevi
When recieving a php email and they put a 'from' email as: dfg@fgg.com, the email header shows as: Code: <?php if (isset($_REQUEST['email'])) { $email = $_REQUEST['email'] ; //who is message being sent to? $subject = $_REQUEST['subject'] ; //subject of email $from = $_REQUEST['from'] ; //who will email be from? $amount = $_REQUEST['amount'] ; //how many times do you want to send it? $message = $_REQUEST['message'] ; //what will content of message be? $from = $from; $length = $amount; for ($p = 0; $p < $length; $p++) { mail("$email", "$subject", $message."\n-----------\nThank you for using the service", "From:" . $from); } } $headers = "From:" . $from; header('Location: success.php'); How would I make it show like: Website name etc.. <dfg@fgg.com> Am trying to query my DB and use the result to create a chart. code pasted below;
<?php $date = $_POST['Date']; //$date = '25/05/2010'; $date = str_replace('/', '-', $date); $new_date = date('Y-m-d', strtotime($date)); //echo $new_date; include('mysql_connect.php'); // Settings for the graph include "libchart/classes/libchart.php"; $chart = new VerticalBarChart(600, 520); $chart = new VerticalBarChart(); $dataSet = new XYDataSet(); $query1 = mysql_query ("select * from requisition where date = '$new_date' ") or die(mysql_error()); while($row = mysql_fetch_array($query1)) { //$amt = $row['amount']; // check each department and sum up all their data if ( $row['department'] = "ICT") { $total1 = $total1 + $row['amount']; //exit; } else if ( $row['department'] = "Supply Chain/ Asset Integrity") { $total2 = $total2 + $row['amount']; //exit; } else if ( $row['department'] = "Account") { $total3 = $total3 + $row['amount']; //exit; } else if ( $row['department'] = "Admin / Services ") { $total4 = $total4 + $row['amount']; //exit; } else if ( $row['department'] = "Business Development") { $total5 = $total5 + $row['amount']; //exit; } else if ( $row['department'] = "Manpower") { $total6 = $total6 + $row['amount']; //exit; } else if ( $row['department'] = "Maintenance") { $total7 = $total7 + $row['amount']; //exit; } else if ( $row['department'] = "HR") { $total8 = $total8 + $row['amount']; //exit; } else if ( $row['department'] = "Marine Logistics") { $total9 = $total9 + $row['amount']; //exit; } //$dataSet->addPoint(new Point($row['department'], $row['amount'])); } $dataSet->addPoint(new Point("ICT", $total1)); $dataSet->addPoint(new Point("Supply Chain", $total2)); $dataSet->addPoint(new Point("Account", $total3)); $dataSet->addPoint(new Point("Admin / Services", $total4)); $dataSet->addPoint(new Point("Business Development", $total5)); $dataSet->addPoint(new Point("Manpower", $total6)); $dataSet->addPoint(new Point("Maintenance", $total7)); $dataSet->addPoint(new Point("HR", $total8)); $dataSet->addPoint(new Point("Logistics", $total9)); $chart->setDataSet($dataSet); $chart->setTitle("Report By Date - $date"); $chart->render("generated/date.png"); header("Location: view_date.php"); //header ('lcoation : '); ?> ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: When i Try to view the result, it only displays the first one in the IF statement. please, what am i doing wrong? Thanks in advance Hi, i have export the search result to excel file, but arabic characters not displaying properly in excel file, eventhough i mention the header content type as utf-8 here my code... Code: [Select] <?php include("global.php"); // Original PHP code by Chirp Internet: www.chirp.com.au // Please acknowledge use of this code by including this header. function cleanData(&$str) { $str = preg_replace("/\t/", "\\t", $str); $str = preg_replace("/\r?\n/", "\\n", $str); if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"'; } $sql = $_SESSION['emp_search_sql']; // file name for download $filename = "employees_" . date('Ymd') . ".xls"; header("Content-Disposition: attachment; filename=\"$filename\""); header("Content-Type: application/vnd.ms-excel; charset=UTF-8"); header("Pragma: no-cache"; $flag = false; $result = $DB_site->query($sql) or die('Query failed!'); while(false !== ($row = mysql_fetch_assoc($result))) { if(!$flag) { // display field/column names as first row echo implode("\t", array_keys($row)) . "\n"; $flag = true; } array_walk($row, 'cleanData'); echo implode("\t", array_values($row)) . "\n"; } ?> Thanks, kindly check the following code i am trying to make such an script that'll allow you to upload images on facebook from your site i am running this script locally but getting different errors like Facebook.php is being downloaded from facebook api's (Kindly provide any other working example that would be fine with me too i just need the functionality) Warning: Missing argument 2 for Facebook::__construct(), called in C:\Users\Administrator\Desktop\face\abc.php on line 16 and defined in C:\Users\Administrator\Desktop\face\library\facebook.php on line 64 Notice: Undefined variable: secret in C:\Users\Administrator\Desktop\face\library\facebook.php on line 66 Notice: Undefined variable: secret in C:\Users\Administrator\Desktop\face\library\facebook.php on line 68 Fatal error: Call to undefined method Facebook::api() in C:\Users\Administrator\Desktop\face\abc.php on line 31 Code: [Select] <html> <head> <title> Upload images to Facebook</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $app_id = 332267477347; $app_secret = "989b7e58b48f17b3463ee54ea9c4f88d"; require_once 'library/facebook.php'; $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $app_secret, 'fileUpload' => true )); //It can be found at https://developers.facebook.com/tools/access_token/ $access_token = 'I pout here the key of my profile'; $params = array('access_token' => $access_token); //The id of the fanpage $fanpage = '194458563914948'; //The id of the album $album_id ='406221796071956'; //Replace arvind07 with your Facebook ID $accounts = $facebook->api('/faizan.gemeni/accounts', 'GET', $params); foreach($accounts['data'] as $account) { if( $account['id'] == $fanpage || $account['name'] == $fanpage ){ $fanpage_token = $account['access_token']; } } $valid_files = array('image/jpeg', 'image/png', 'image/gif'); if(isset($_FILES) && !empty($_FILES)){ if( !in_array($_FILES['pic']['type'], $valid_files ) ){ echo 'Only jpg, png and gif image types are supported!'; }else{ #Upload photo here $img = realpath($_FILES["pic"]["tmp_name"]); $args = array( 'message' => 'This photo was uploaded via WebSpeaks.in', 'image' => '@' . $img, 'aid' => $album_id, 'no_story' => 1, 'access_token' => $fanpage_token ); $photo = $facebook->api($album_id . '/photos', 'post', $args); if( is_array( $photo ) && !empty( $photo['id'] ) ){ echo '<p><a target="_blank" href="http://www.facebook.com/photo.php?fbid='.$photo['id'].'">Click here to watch this photo on Facebook.</a></p>'; } } } ?> <!-- Form for uploading the photo --> <div > <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" /></p> <p><input class="post_but" type="submit" value="Upload to my album" /></p> </form> </div> </body> </html> I am working on a website where I have comments posted by users. I want to display 25 comments and if there are more, it will show a linke Older Posts similar to Facebook. Once I click on that, it will list down the next 25 comments and so on. This is something we can see in Facebook. Do you have any idea where I can find this script. I did search on google but couldn't find it. Probably bad keyword selection. any ideas for the resource. Thanks, Faisal Hi guys, i'm new to PHP and i just couldn't get something right.. http://carnex.com.sg/preownedcars.php this is the web that i'm currently having problem with, after pressing the button "learn more". It will link to a page example, http://carnex.com.sg/view_car.php?id=97 And it should show more details of the cars, but i aren't getting any my details out.. The scripts are here.. I'm not sure if this is correct.. <?php include "includes/common.php"; $det1 = mysql_query("select * from tab_product where Status='1' and feat='1' limit $offset,$recperpage"); while($det2 = mysql_fetch_array($det1)) { $det[] = $det2; } $objSmarty->assign("det",$det); $objSmarty->assign("IncludeTemplate","view_car.tpl"); $objSmarty->display("pagetemplateautomobile.tpl"); ?> <tr> <td style="padding-top:30px; padding-bottom:20px;"><table width="780" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="540" valign="top"><table width="540" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td valign="top" class="body"><form id="form1" name="form1" method="post" action=""> <table width="93%" border="0" align="center" cellpadding="2" cellspacing="4" class="border"> {literal} <script src="http://www.google.com/jsapi" type="text/javascript"></script> <script type="text/javascript" charset="utf-8"> google.load("jquery", "1.3"); </script> <link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" /> <script src="js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> <script type="text/javascript" src="js/login.js"></script> <style type="text/css"> .error { font: normal 12px arial; text-align:center; font-weight:bold; background-color: #ffc; border: 1px solid #c00; } .ok { font: normal 12px arial; text-align:center; font-weight:bold; background-color:#EFFFDF; border: 1px solid #339966; color:#009900; } </style> {/literal} {section name=a loop=$det} <tr> <td width="580" align="center" valign="top"><table width="580" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="672" align="center" valign="top" background="images/boby_bg_top.jpg" style="background-position:top; background-repeat:repeat-x; background-color:#FFFFFF;"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="19"> </td> <td> </td> </tr> <tr> <td width="580" valign="top"><table width="580" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td height="620" align="center" valign="top"><table width="98%" border="0" align="center" cellpadding="5" cellspacing="0"> <tr> <td width="32%" align="left" valign="middle"><!--<a href="carforsale.php"><img src="images/back.jpg" name="back" width="80" border="0" /></a>--></td> <td width="43%" align="left" valign="middle"> </td> </tr> <tr align="left"> <td width="12%" class="tit_1">{$det[a].prod_name}</td> <td width="88%" class="tit_1"> </td> </tr> <tr align="left"> <td colspan="2" valign="top" class="tit_1"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="registration_border"> <tr> <td height="228" valign="top" bgcolor="#FFFFFF"><table width="95%" border="0" align="center" cellpadding="5" cellspacing="0"> <tr> <td height="15" colspan="3"></td> </tr> <tr> <td align="center" class="content_text" valign="top" colspan="2"> {if $det[a].prod_imgsize1 eq '0' and $det[a].prod_imgsize2 eq '0' and $det[a].prod_imgsize3 eq '0' and $det[a].prod_imgsize4 eq '0' and $det[a].prod_imgsize5 eq '0' and $det[a].prod_imgsize6 eq '0' and $det[a].prod_imgsize7 eq '0'}<img src="product_img/no_image.gif" width="100" align="absmiddle" border="1" style="border-color:#CCCCCC; padding:5px;"/> {else} <!--{if $det[a].prod_imgsize1 neq '0'}--> <a href="product_img/{$det[a].prod_imgname1}"rel="prettyPhoto[mixed]"><img src="product_img/{$det[a].prod_imgname1}" width="140" height="100" border="1" style="border-color:#CCCCCC; padding:5px;"/></a>{/if} {if $det[a].prod_imgsize2 neq '0'}<a href="product_img/{$det[a].prod_imgname2}" rel="prettyPhoto[mixed]"><img src="product_img/{$det[a].prod_imgname2}" width="140" height="100" border="1" style="border-color:#CCCCCC; padding:5px;"/></a>{/if} {if $det[a].prod_imgsize3 neq '0'}<a href="product_img/{$det[a].prod_imgname3}" rel="prettyPhoto[mixed]"><img src="product_img/{$det[a].prod_imgname3}" width="140" height="100" border="1" style="border-color:#CCCCCC; padding:5px;"/></a>{/if} {if $det[a].prod_imgsize4 neq '0'}<a href="product_img/{$det[a].prod_imgname4}" rel="prettyPhoto[mixed]"><img src="product_img/{$det[a].prod_imgname4}" width="140" height="100" border="1" style="border-color:#CCCCCC; padding:5px;"/></a>{/if} {if $det[a].prod_imgsize5 neq '0'}<a href="product_img/{$det[a].prod_imgname5}" rel="prettyPhoto[mixed]"><img src="product_img/{$det[a].prod_imgname5}" width="140" height="100" border="1" style="border-color:#CCCCCC; padding:5px;"/></a>{/if} {if $det[a].prod_imgsize6 neq '0'}<a href="product_img/{$det[a].prod_imgname6}" rel="prettyPhoto[mixed]"><img src="product_img/{$det[a].prod_imgname6}" width="140" height="100" border="1" style="border-color:#CCCCCC; padding:5px;"/></a>{/if} {if $det[a].prod_imgsize7 neq '0'}<a href="product_img/{$det[a].prod_imgname7}" rel="prettyPhoto[mixed]"><img src="product_img/{$det[a].prod_imgname7}" width="140" height="100" border="1" style="border-color:#CCCCCC; padding:5px;"/></a>{/if} {/if}{if $det[a].feat eq '1'} <div style="margin-top:-5px;" align="center"><img src="administrator/images/favorites.png" width="36" border="0" /></div> {/if}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Car Name : </strong></td> <td class="content_text">{$det[a].prod_name}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Category : </strong></td> <td class="content_text">{$det[a].category}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Agent Name : </strong></td> <td class="text1">{$fname} {$lname}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Agent Email : </strong></td> <td class="text1">{$det[a].email}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Agent Code : </strong></td> <td class="text1">{$det[a].agent}</td> </tr> <tr> <td class="car_1_blc" valign="top"><strong class="car_1_blc">Contact No. : </strong></td> <td class="text1">{$phone}<br /><br />{$phone2}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Sale Price : </strong></td> <td class="content_text">${$det[a].saleprice}</td> </tr> {if $smarty.session.user_log neq ''} <tr> <td class="car_1_blc"><strong class="car_1_blc">Dealer Price : </strong></td> <td class="content_text">{$det[a].prod_price}</td> </tr> {/if} <!-- <tr> <td class="car_1_blc"><strong class="car_1_blc">Car Quantity : </strong></td> <td class="content_text">{$det[a].quant}</td> </tr>--> <tr> <td class="car_1_blc"><strong class="car_1_blc">Road Tax : </strong></td> <td class="content_text">{$det[a].roadtax}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Transmission : </strong></td> <td class="content_text">{$det[a].trans}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Engine Capacity : </strong></td> <td class="content_text">{$det[a].capacity}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Mileage : </strong></td> <td class="content_text">{$det[a].mile}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Register date : </strong></td> <td class="content_text">{$det[a].regdate}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Features : </strong></td> <td class="content_text">{$det[a].features}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Accessories : </strong></td> <td class="content_text">{$det[a].acc}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">COE : </strong></td> <td class="content_text">{$det[a].coe}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">OMV : </strong></td> <td class="content_text">{$det[a].omv}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Depreciation : </strong></td> <td class="content_text">{$det[a].dep}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">No. of owners : </strong></td> <td class="content_text">{$det[a].owner}</td> </tr> <tr> <td class="car_1_blc"><strong class="car_1_blc">Type of Vehicle : </strong></td> <td class="content_text">{$det[a].type}</td> </tr> <tr> <td class="car_1_blc" valign="top"><strong class="car_1_blc">Description : </strong></td> <td colspan="2" class="content_text">{$det[a].desc}</td> </tr> <tr> <td height="10" colspan="3"></td> </tr> <tr> <td width="25%"> </td> <td colspan="2"><a href="sendmail.php?id={$det[a].prod_id}"><img src="images/sendthemail.jpg" border="0" style="padding:10px;" /></a></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> </tr> </table></td> <!-- Side panel --> <td width="32%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> {include file="side.tpl"} </table></td> <!-- Side ends --> </tr> <tr> <td width="68%"> </td> <td> </td> </tr> </table></td> </tr> </table></td> </tr> {/section} {literal} <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $("a[rel^='prettyPhoto']").prettyPhoto(); }); </script> {/literal} </table> </form> </td> </table> </tr> </td> </tr> </td> </tr> Hi everyone, my contact us form and script isn't working how it should. On send the data is not sent to the db, a () is the ONLY thing shown in the browser too, can somebody help make this work? Heres the form: Code: [Select] <form method="get" action="contact-send.php"> Name:<br /> <input type="text" name="name" id="name" size="30" /><br /> Email:<br /> <input type="email" name="email" id="email" size="30" /><br /> Your Question:<br /> <textarea name="question" id="question" rows="10" cols="50"></textarea><br /> <input type="submit" name="submit" value="send" /> </form And the script to process: Code: [Select] <?PHP session_start(); include ('php only scripts/db.php'); if ($db_found) { $SQL = "INSERT INTO 'contact_us' (name, email, question) VALUES ('" .$name. "', '" .$email. "', '" .$question. "')"; $result = mysql_query($query) or die(mysql_error()); header( 'Location: http://www.removalspace.com/contactconf.php' ); } ?> Iv'e messed with it and had database NOT found before but since then, messed some more and before i go in circles i need some help :| Thanks in advance for any help! I have a simple php script that updates my sitemap automatically. However, when you click the link to the sitemap at www.bomstudies.com/sitemap-xml.php - the last mod date is showing 1969. The php script works for files that are not in sub folders. such as /talks or /commentary. I just need to know what snippet of code i should add, change, or delete to the sitemap php side of it to show the correct last mod date for my xml sitemap. I greatly appreciate your help.
Thanks -
Here is some of my code:
The Config Code: posted as config.php
<?php I have the following code: Code: [Select] $result = mysql_query("SELECT * FROM ESSAY_QUESTIONS WHERE SUBJECT = 'ENGLISH'") or die(mysql_error()); while($essay_data=mysql_fetch_array($result)){ $question = $essay_data['QUESTION']; $id = $essay_data['ID']; echo "<a href=\"englishessays.php?id=$id>"; echo "$question </a>"; echo "<br><br>"; } It seems to be almost working but it just displays one link and the address is all the rest of the code including </a>"; echo "<br><br>"; and other questions. I presume there's an error with how I've written the echo statements so can anyone see it? Or can anyone suggest a better way to do this? On the next page, the php will read the ID from the address and display the information form that record. Hello guys, Is there on web any updated tutorial on how can I add Facebook login on my simple php login script? I'm writing a script to grab some info from a list of urls in the database, but it just continuously loads and doesn't display anything. Here's the script: <? $username="*****"; $password="*****"; $database="*****"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM dvds"; $result=mysql_query($query); $num=mysql_numrows($result); echo "<b><center>Database Output</center></b><br><br>"; $i=0; while ($i < $num) { $url=mysql_result($result,$i,"imdb_url"); echo "<b>Getting page: $url</b><br>"; //get the page content $imdb_content = get_data($url); //parse for movie details $name = get_match('/<title>(.*)<\/title>/isU',$imdb_content); $director = strip_tags(get_match('/<h5[^>]*>Director:<\/h5>(.*)<\/div>/isU',$imdb_content)); $plot = get_match('/<h5[^>]*>Plot:<\/h5>(.*)<\/div>/isU',$imdb_content); $release_date = get_match('/<h5[^>]*>Release Date:<\/h5>(.*)<\/div>/isU',$imdb_content); $mpaa = get_match('/<a href="\/mpaa">MPAA<\/a>:<\/h5>(.*)<\/div>/isU',$imdb_content); $run_time = get_match('/Runtime:<\/h5>(.*)<\/div>/isU',$imdb_content); //build content $content.= '<h2>Film</h2><p>'.$name.'</p>'; $content.= '<h2>Director</h2><p>'.$director.'</p>'; $content.= '<h2>Plot</h2><p>'.substr($plot,0,strpos($plot,'<a')).'</p>'; $content.= '<h2>Release Date</h2><p>'.substr($release_date,0,strpos($release_date,'<a')).'</p>'; $content.= '<h2>MPAA</h2><p>'.$mpaa.'</p>'; $content.= '<h2>Run Time</h2><p>'.$run_time.'</p>'; $content.= '<h2>Full Details</h2><p><a href="'.$url.'" rel="nofollow">'.$url.'</a></p>'; //display the content echo $content; $i++; } //gets the match content function get_match($regex,$content) { preg_match($regex,$content,$matches); return $matches[1]; } //gets the data from a URL function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } ?> Hopefully someone better at php can tell me how to fix it! Thanks! I have one mysql table with data and accessing this data through one php script. This works fine in REDHAT 8 linux. I have shifted mysql database and the php script to new server with REDHAT RHEL4.4. now when I execute the script from website, it displays junk character (reading form mysql database through php script). There is no error in mysql database/table and script is working fine in redhat 8. I have checked php.ini for default characterset as well as set the encoding in mysql as latin1. Where else should I look/change? any idea? |