How to customize twitter "via" message in PHP? - php

I can't find any mention on how to do this with twitter api. I'd like to do it without buying this commercial software:
http://www.webdesigndev.com/photoshop/how-to-brand-your-tweets-with-your-url-and-why-you-should
I mean not just having my appname but putting any name I want at any time.

I think it's chosen when you create the application for the twitter API: http://dev.twitter.com/apps/new

Currently this can only be done if your application implements OAuth authentication to Twitter. In the past, non-OAuth apps were able to send a source parameter, but that has been discontinued for any new apps.
From Twitter's API FAQ
If you would like tweets from your
application to receive a source
parameter, please register an
application and implement OAuth
authentication. We will automatically
include your application as the source
for any tweets sent from your
application.
Also, check out this similar SO question.

Related

How to generate Azure O365 APIs to get user details which we have created on azure portal using php

I am new to AZURE O365 portal, I have created some users in azure portal.
How can I create API in Azure portal to get the user details which I have already created in the portal and are they users enabled or disabled using PHP.
I tried: I have created application and I created secret Id in the portal, then what I have to do, to generate API for user list using php.
please help on it.
Thanks
Sandeep
Not sure if I undestand you correctly: you created some users on the azure portal and you want to get these users using PHP?
Azure has many APIs, they also have an API for getting these users, here is the specification and example code (not in php, but I think still easy to understand):
https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http
Basically you can access that data using graphql client. There are many graphql libraries for php. But as I skimmed through the docs, you don't really need a library, just a way to create http requests, I recommend Guzzle.
Before you create that php code, I recommend to simply play with the API by using postman or other api client. If it works there, you can start to create the php code.
The code is basically a http POST request (or whatever is specified in the documentation). The request should contain your API tokens in the header, thats all. Data will be provided usually as JSON. Here are some examples how to use guzzle in php for graph.

Can you get a short-lived OAuth 2.0 access token for Firebase in PHP?

i am currently working on a Project with Firebase and i am trying to Implement the Firebase Cloud messaging service. I manage to make it work with a combination of PHP and Javascript (Javascript sends a Requiest to the server, where php makes a call to the Firebase API to send out a Notification).
The problem here is, that the code i use is for the old version, so its not using the HTTP v1.
When i looked at the docs on how to upgrade to the new version, i found out you need a short-lived OAuth 2.0 access token.
Thing is, the docs only show how you can get it via node.js, java, python, c# and go.
So my question is, is there a way to get the short-lived OAuth 2.0 access token with php or do i have to use something like node.js for it?
I'm not sure I fully understand your requirements, but if you want to send FCM notification from a PHP backend, I'd suggest checking out this (unofficial) Admin SDK for PHP (Disclaimer: I'm the creator of that library)
In its current state, you would need a Firebase Service Account (with Admin access) to be able to send notifications with it, but I'm currently working on a feature that will allow you to retrieve an OAuth access token for a given user (https://github.com/kreait/firebase-php/pull/390) in case you really need this.
I'd like to invite you to join https://discord.gg/nbgVfty (the Discord-Community around the PHP Admin SDK) to discuss your use case and process further.
Even if the SDK is not for you, looking through the code might could give you some ideas...
An alternative could be to use the Google PHP Api Client Services library, in which you can find a FirebaseCloudMessaging service.
I hope this helps!

what is oauth and How does Website Implement it

I know the question is Kinda Silly but i want to know what exactly is oauth and how does it work with facebook,twitter etc.
And also if i want to implement it for my website like creating a login from my website button how can i do it
Definition
According to Wikipedia:
OAuth is an open standard to authorization.OAuth provides client applications a 'secure delegated access' to server resources on behalf of a resource owner. It specifies a process for resource owners to authorize third-party access to their server resources without sharing their credentials.
So OAuth is commonly used as a way for web surfers to log into third party web sites using their Google, Facebook or Twitter accounts.
Working Example
Lets say you have a Gmail Account. You decide to sign up for LinkedIn.Adding your friends manually can be sketchy and painful. You might get fed up half-way. So you might be tempted not to create an the LinkedIn account after all.
LinkedIn got a nice idea and wrote a program to let the computer fetch all the data from your Gmail Account.
Without an API for exchanging this list of contacts, you may have to comprimise your email account to LinkedIn so here is where OAuth takes charge. If your Gmail supports the OAuth protocol, then LinkedIn can ask you to authorize them to access your GMail list of contacts.
References :
1)http://en.wikipedia.org/wiki/OAuth
2)https://blog.apigee.com/detail/when_to_use_oauth

Prevent Google OAuth 2.0 redirection for Google Drive API Integration

I'm trying to implement Google Drive API. They have quick start example here which is using Google OAuth 2.0. Using for a web application where user will use drive api for creating folder and save files, edit files etc.
Now the problem is OAuth 2.0 is redirecting the page and for authCode and then back to callbackUrl again ie. the usual way. Is there any way so that I can get the authCode without redirecting the url, by using cURL or some library that can do that without redirecting.
I'm using PHP for this app.
We currently offer an alternative flow for installed apps that doesn't redirect back to an app but outputs the exchange code. In order to be sure that user is explicitly giving permissions to your application, we need to intercept the flow for a user action.
If there are no end users involved in your use case, you may like to take a look at the service accounts: https://developers.google.com/accounts/docs/OAuth2ServiceAccount Service accounts also provide impersonation for Google Apps domains.

Windows Live oAuth wrap for contacts?

I would like to know if the oAuth wrap authentication facility by windows live is just for messenger connect or what?
Can it be used for Live Contacts API?
I am trying to fetch addressbook from live contacts. How can i do that?
Microsoft's msdn documentation on various APIs sucks to the core!! They doesnt even have any specific working PHP example for this.
Can somebody redirect me to the well organized documentation/tutorial on this?
Not sure if you've figured this out yet, but I am looking into it as well. I don't have a working sample yet, but the answer is YES, OAuth WRAP can be used for the Live Contacts API as well as any other Messenger Connect APIs. It's actually fairly straightforward if you've used OAuth before. You would obtain authorization as with any other provider (eg. Facebook, LinkedIn, Google, etc.), and then obtain an access token:
http://msdn.microsoft.com/en-us/library/ff750952.aspx
You would then pass that access token in the Authorization header (curl_setopt, CURLOPT_HTTP_HEADER) and continue with the REST call as if you had authorized using the Live SDK.

Categories