Google Maps Places Details request (PHP) - php

I read so many messages with that REQUEST_DENIED error but I still couldn't figure out why it's not working! My google API key has Places and Gmap v3 services activated. The key is working since my Autocomplete app is working with it. I'm also using the same domain as my Autocomplete app. I'm trying to check a place's details with its reference.
To spare you all my attempts, let's say I use this class and here is my code:
require('googlePlaces.php');
$g = new googlePlaces("MyGoogleAPIKey");
$g->setLanguage("fr");
$g->setReference($_GET['ref']);
var_dump( $g->details() );
But I kinda doubt that this is a code problem, since when I type the URL in the browser it should work, no?
When I echo the $URLToCall I have this. And that URL in a browser give me a REQUEST_DENIED.
I'm lost :(
Thanks for any hints!

Ok folks, I kind of hate myself.
I lost 2 days trying to figure out what was going wrong.
For I don't know what reasons, I had to create a new project and get a new API key.

Related

Sending a PUT request from PHP to Hubspot

This problem is really bugging me, i'm a hobby programmer who right now is trying to follow the simple instructions of Hubspots CRM API documentation.
I've managed to retrieve and POST information from and to Hubspot using cURL/PHP, but now i'm facing an update(PUT) and i can figure it out.
I'm trying to associate a "Deal" with a "Contact" inside the CRM, it seems to be so easy, just fire away a url? :)
The documentation on the API says:
Note: You only need to use this endpoint when updating existing deal records. If you are creating new deals, you can make these associations when creating the record by including the associations data as documented on the create deal page."
src: https://developers.hubspot.com/docs/methods/deals/associate_deal
Do i understand correctly, i tried to use this URL in my browser and expected an update to happen?
https://api.hubapi.com/deals/v1/deal/DEALID/associations/CONTACT?id=CONTACTID&hapikey=MyKey
The response i got in the browsers console was: 405 (Method not allowed).
I tried to fire the url though cURL aswell, but got lost right away because i dont really have any data to send in "CURLOPT" parameters, the data should, if i understand correctly be inside the endpoint url.
If you have any idea of what this hobby programmer doesnt understand, please reply :)
Kind regards,
Simon

Facebook graph command creating duplicate album

I've been using the Facebook php sdk to interact with facebook quite successfully. When I tried to create a photo album the code created a duplicate. At first I thought it was the php sdk (using 3.x). I tried switching to Perl with LWP::UserAgent and LWP::Simple::Post to use the http url for graph. Nothing is working. Every way I try I get double albums when I call the code. I've ensured that the code is being called once (mainly because I've created a super small test script to do it and have made outputs to ensure on the command line that it's only calling once.
Here's the url I'm using:
https://graph.facebook.com/me/albums?access_token=<access_token>&name=Test+Album+2&message=Test+Description
I've taken off the privacy setting from the url and it hasn't changed the behavior. If I run this directly in the graph explorer, it creates only one album. But any other method (yes, I am using POST and not GET and yes I've tried to pass all the params as post data individually rather than via querystring, either way results in duplicate albums) causes duplicate albums.
Has anyone experienced this? How do I fix it??? I'm at my wits end trying to figure this out.
I've tried it on multiple servers in thoughts that perhaps one of them was using a proxy causing the duplicate call, but whether I run it on my hosting service or on my localhost, I still get duplicates.
No matter what I've tried, if I am creating the album via code in PHP or Perl I get double albums created. HELP!
My first answer was deleted for some reason so I'm not sure what to do at this point. This question can't be answered because:
The issue was not with the SDK but with Facebook itself. I had created a bug report after doing some more tests. Facebook confirmed and fixed the bug. Basically, it had to do with inappropriate permissions handling.
https://developers.facebook.com/bugs/1435856773345641/
There was a bug in Facebook's handling in this instance. I'm hoping this answer doesn't get deleted because someone else may experience this and want to know that it was a bug in Facebook code, not in the PHP SDK or in the user code.
Not sure why Andrew Barber would delete that answer.
Unless someone has a better answer than what Facebook gave to me via bug report follow-up.

Searching twitters public timeline using JQuery

So a while back I used to use the twitter json search in one of my apps but it seems since the change in API versions there has been some major changes which even after reading the documentation I still can't get my head around and it really doesn't make it very easy to understand so hopefully one of you tech guys out there can help me out.
I want to clean my application up so it works again in plainly doing the following:-
http://search.twitter.com/search.json?
q='+param+'&
rpp=100&
result_type=recent&
lang=en
Obviously with the changes this is no longer possible but I want to be able to do this again using the new address but in JQuery unless someone can suggest either a tutorial or a piece of code or even a link to a topic where I could get my answer. I'm also open to using PHP as this is what I used at one point with searching Facebook's timeline and you can get an access token using $.get() for Facebook so surely it would be the same with Twitter too?
Any advice/code is welcome.
Thanks!
the search API needs authorization now. I'd say that, first off, you need to call the https url not http.
With Abhramam William's library you'd do something like the following, after having received your app's bearer token:
$your_tweets = $connection->get("https://api.twitter.com/1.1/search/tweets.json?q=from:grey_mina&result_type=recent&count=5");

Google Calendar API - Not showing calendar

I've downloaded the Google API Client and installed it on my Server. I set up my API and my client ID.
I configured the PHP file and now I'm trying to open it:
http://euotm.net/google-api-php-client/examples/calendar/simple.php
I signin using a Google Account, but then all I get is a code.
WHy does that happen? I need it to show a calendar.
I'm new to this API, so I really don't know much.
Thanks ahead,
Tom.
Indeed google calendar api doesn't provide a display widget to integrate calendar to your application. The api only gives you the possibility to retrieve every details about your calendars and their events, and then you'll have to find a way to display it on your screen if you want a nice layout.
have you
require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_CalendarService.php';
these files in your code ? i think you may miss it. what error, you are getting kindly make more sense about this
I am having the same issue. From what I've found so far, it looks like RadASM is right, but I was wondering what you moved on to in terms of which widget/gadget you used to display your actual calendar.
If you haven't found it yet, you may be looking for this:
https://developers.google.com/google-apps/calendar/gadgets/event/
Please let me know what you went with.
RadASM is right. Google Calendar API provides well structured data for the calendars and calendar events, allowing data manipulation, too. Desiring your custom layout, you need to take care of it.
Here is a detailed explanatory article with full demo code within a single HTML file - Easy and compact access to your Google calendars.

Fetch google calendar events from php

I've been playing with the samples from this site: http://code.google.com/intl/sv-SE/apis/calendar/v3/using.html
All I want to do fetch the cal data from a public calendar. But so far there's always something that makes me hit a wall. I'm doing a webapp but it always pointing to a specific calendar that is public. I don't need to use oauth. only the api key. But I really can't find any samples of doing this.
Any hint to get me in the right direction. I don't even know what to try after trying the samples on that page.
see actually how it processed using oauth here.
https://code.google.com/oauthplayground/
you can get step to implement this.
you have to use
https://www.googleapis.com/calendar/v3/calendars/{calendarId}/events/{eventId}

Categories