Fan-Gate using FB SDK 4 - php

I'm trying to connect an app to a facebook page ... up till that it's fine as it displays in the tabs. Also a simple echo works fine.
I'm using this guide to get it working: https://www.webniraj.com/2014/06/11/facebook-api-creating-page-apps-using-facebook-php-sdk-4-0-x/
I have tried to set some echos so I'd know where it's getting stuck and from what I have it seems it's getting stuck in the
$pageHelper = new FacebookPageTabHelper();
The code works fine on the server where it is uploaded
Any help would be appreciated,
Thanks :)

That tutorial is aweful. All those require calls when you could just use the existing autoloader.php instead. FacebookPageTabHelper extends FacebookCanvasLoginHelper, so you don´t have to add it separately.
Try this one instead: http://www.devils-heaven.com/facebook-php-sdk-4-0-tutorial/
See "Using the Page Tab Helper" in the article:
require 'phpsdk4/autoload.php';
use Facebook\Helpers\FacebookPageTabHelper;
FacebookSession::setDefaultApplication('APP-ID', 'APP-SECRET');
$helper = new FacebookPageTabHelper();
echo '<p>page id: ' . $helper->getPageId() . '</p>';
echo '<p>liked: ' . $helper->isLiked() . '</p>';
echo '<p>admin: ' . $helper->isAdmin() . '</p>';
Important: You need PHP 5.4+ to use the new PHP SDK. - If the code does not work, it´s most likely a problem with the server.

Related

Url got replaced to a symbol

i've been working on reset password url, let me get straight to the point.
Here's my sample code that i'm working on. I believe it's working fine on apache. But i'm currently working on IIS Server.
$resl_url = base_url() . $this->controller . "/reset_by_link?reset_code=" . $random . "&u=" . $baris->usr_id . "&e=" . $enc_username;
$mail_data['reset_link'] = $resl_url;
it produce this url:
https://hris-id.tmf-group.com/ess_lenovo/login/auth/reset_by_link?reset_co=e=5T/BX1GRDU&u=2&e=lffdmdnhkjjogdmkkmkpibjbkefnjgbc
and this is the url that i expected to appear:
https://hris-id.tmf-group.com/ess_lenovo/login/auth/reset_by_link?reset_code=5T/BX1GRDU&u=2&e=lffdmdnhkjjogdmkkmkpibjbkefnjgbc
Note: this url is being sent by email.
Will appreciate any help.
Thank you in advance.

QR code for calendar event in php

I have used the code found on this page to generate QR codes.
I want to generate a QR code for calendar event. I tried using this function:
function calendar_event($summary, $dtstart, $dtend){
$this->data = "BEGIN:VEVENT:SUMMARY:" . $summary . ";dtstart:" . $dtstart . ";dtend:" . $dtend . ";END:VEVENT;";
}
But it doesn't seem to work. Could anyone help me?
I think you are missing the \n. And you should not use ;, but : in terms of a key-value pair.
This is working for me: BEGIN:VCALENDAR\nBEGIN:VEVENT\nDTSTART:20110422\nDTEND:20110422\nSUMMARY:Karfreitag\nEND:VEVENT\nEND:VCALENDAR
Complete code can be
BEGIN:VEVENT\nSUMMARY:My+Event\nDESCRIPTION:Description\nLOCATION:Location\nDTSTART:20200225T114509Z\nDTEND:20210225T114509Z\nEND:VEVENT

how to fetch state parameter from google app

google login
I am working on php . I have made app on Google . If u can see my link , I am using state parameter , in which state=reg . In my callback page , I am trying to get this value ie $_get['state'] but its not showing me anything . Am i doing the right way ?
I've never seen a Client ID that begins "**", but in your link I see client_id=%2a%2a43760%2a%2a%2a%2a%2a-cp7 which really looks wonky. Are you sure that’s right?

extracting links as clickable links from sql table

Been at this for a while and cant figure it out so i thought id come to the ppl who know.
my php / sql is so-so but.....this is what im trying to do / figure out..
i have a database setup to take in messages (of any sort) and works fine. The user enters data in a field, hits send, and the message gets logged.
But when a user puts in a link for example " http://www.google.com "
its stored in the DB just fine but when its printed back onto the page, it comes back as plain
text, what i want is that when the page throws back the message with the link in it, that the link is live and clickable.
Ive googled my a$# off but im guessing im searching for the wrong thing (or im missing something unbeknownst to me. )
Any tips/*direction* etc, ill gladly accept. also, I dont mind doing the work/research so if you have links only ill take those too.
Thanks in advanced.
You need to parse messages plain text in order to find links. Then, change link texts by adding an anchor tag (<a>).
This link should help you.
you need regular expressions to detect links and convert them to ...
see the answer here:
PHP validation/regex for URL
<?php echo "your_field"; ?>
Something like this should work (I took this from some code I wrote for a client):
$query = mysql_query("SELECT * FROM wcordersinfo WHERE dealer_id = '" . $dealer_id . "' && drawing_num = " . $_GET['reference_id'] . "");
while ($orders = mysql_fetch_array($query)) {
if ($orders['drawing_num'] != '') {
$link_open = '<a href="http://www.example.com/dealers/order-details.php?reference_id=' . $orders['drawing_num'] . '">';
$link_close = '</a>';
} else {
$link_open = $link_close = '';
}
and then where you want to display the content:
<?php echo "<li>' . $link_start . $orders['carrier'] . $link_end . '</li>"; ?>
You may want to check out http://www.php.net/manual/en/function.preg-replace.php for replacing regular expressions with something.
There you want to replace every website with a typical html link syntax like ...

How to share link via twitter from another site?

Is there any way to share link of specific website through my twitter account with PHP? Instead of going to that website and clicking share and authenticating and posting, can i do all this with PHP? If yes, how? Meanwhile, I've managed to get the desired format for posting:
$tweeter_link = "https://twitter.com/share?original_referer=" . $link . "&related=&source=tweetbutton&text=" . $title . "&url=" . $link . "&via=SomeThing";
But I can't process it properly with curl.

Categories