Freebase Error Code: 403 - User Rate Limit Exceeded. Please sign up - php

I keep on getting the below error when fired from the code even though I have signed up and attach key to the url :-
Freebase Error Code: 403 - User Rate Limit Exceeded. Please sign up
When I try to fire the same url from the browser then the result set is displayed which shouldnt be the case as the error says I have crossed some limit or something.
My Query :-
[{
"id": null,
"mid": "/m/07kw5b",
"name": null,
"/sports/sports_league/teams": [{
"mid": null,
"team": null,
"/sports/sports_league_participation/team": [{
"mid": null,
"id": null,
"name": null
}]
}]
}]
Below is the url:-
https://www.googleapis.com/freebase/v1/mqlread?query=%5B%7B%0A%09%09%09%09%09%09%09%09%09%09++%22id%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09++%22mid%22%3A+%22%2Fm%2F07kw5b%22%2C%0A%09%09%09%09%09%09%09%09%09%09++%22name%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09++%22%2Fsports%2Fsports_league%2Fteams%22%3A+%5B%7B%0A%09%09%09%09%09%09%09%09%09%09%09%22mid%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09%09%22team%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09%09%22%2Fsports%2Fsports_league_participation%2Fteam%22%3A+%5B%7B%0A%09%09%09%09%09%09%09%09%09%09%09++%22mid%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09%09++%22id%22%3A+null%2C%0A%09%09%09%09%09%09%09%09%09%09%09++%22name%22%3A+null%0A%09%09%09%09%09%09%09%09%09%09%09%7D%5D%0A%09%09%09%09%09%09%09%09%09%09++%7D%5D%0A%09%09%09%09%09%09%09%09%09%09%7D%5D&key=[API-Key]&cursor
PHP Code:-
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_URL, $url); //the above url
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
$json_data = json_decode(curl_exec($ch), true);
curl_close($ch);
I have not fired the query more than 10 times and in my console too under freebase api it says "0 out of 100,000 requests".
My dashboard graph:-
Can anyone please give me some insights on why this error is coming?Is this something to do with configuration as I am firing the url from localhost.

Related

How can I create a form, and create a task on a ClickUp task

For few days I am trying to use the ClickUp API. The goal is:
We have a form, and when the form is submitted, it creates a task on a space on ClickUp.
It is a PHP form, and even with the API Doc here, I am not able to understand how it is working.
I found this: https://jsapi.apiary.io/apis/clickup20/reference/0/tasks/create-task.html
But it requires some access token, from the user, but normally, It's not supposed to work like that.
Here the script that I have taken from the doc:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.clickup.com/api/v2/list/17229593/task");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{
\"name\": \"New Task Name\",
\"content\": \"New Task Content\",
\"assignees\": [
183
],
\"tags\": [
\"tag name 1\"
],
\"status\": \"Open\",
\"priority\": 3,
\"due_date\": 1508369194377,
\"due_date_time\": false,
\"time_estimate\": 8640000,
\"start_date\": 1567780450202,
\"start_date_time\": false,
\"notify_all\": true,
\"parent\": null,
\"custom_fields\": [
{
\"id\": \"0a52c486-5f05-403b-b4fd-c512ff05131c\",
\"value\": 23
},
{
\"id\": \"03efda77-c7a0-42d3-8afd-fd546353c2f5\",
\"value\": \"Text field input\"
}
]
}");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Authorization: "access_token"",
"Content-Type: application/json"
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
When I try that, I get the error 500, and when I go to the API's link, I get an Auth problem.
Is someone know something about this API?

Parsing JSON using php and curl command from an API

I'm trying to parse the JSON information I get, using PHP, from a powershell script that uses a form on the web-page to send an API request that searches a test database and returns a set of clients and I want to eventually put these into a dynamically populated table.
The issue i'm having is that i'm not able to just print out a specified part of the JSON array onto the page
The JSON i'm getting looks like this:
[{
"id": 2,
"firstname": "Edward",
"lastname": "Franks",
"companyname": "",
"email": "EdwardFranks#mail.com",
"datecreated": "2018-10-09",
"groupid": 0,
"status": "Inactive"
},
{
"id": 1,
"firstname": "Frank",
"lastname": "Ti",
"companyname": "U Consultation",
"email": "frank#u.co.uk",
"datecreated": "2018-10-08",
"groupid": 0,
"status": "Active"
}]
We get this information by searching a name or an email address associated with the account.
HTML:
<form method ="post" action = "veeam.PHP">
<ul class="form-style-1">
<li>
<label>Name or Email <span class="required">*</span></label>
<input type="text" name="clientsearch" class="field-divided" placeholder="Enter details" />
<li>
<input type="submit" name="submit" onSubmit="invokeapi()"/>
</li>
</ul>
</form>
PHP:
function invokeapi() {
$client = $_POST["clientsearch"];
$username = 'username';
$password = 'password';
$url = 'http://apiURL/?command=Check-ClientWHMCS%20'.$client;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Length: 0'));
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
$output = curl_exec($ch);
curl_close($ch);
$clientlist = (array) json_decode($output, true);
print_r($clientlist);
echo $clientlist[0]["id"];
}
if(isset($_POST['clientsearch'])) {
invokeapi();
}
When I use the json_last_error command it says there's no issue with the JSON and when I use the isArray command in PHP it says that the variable IS and array so i'm quite stuck on where to go next.
I get some output on the webpage but it just prints out the entirety of the JSON result on a single line with Array ([0] => 1) at the end of it.
Any help on this issue would be massively appreciated.
You need to set CURLOPT_RETURNTRANSFER, now curl_exec() will print out the result immediatly instead of returning it as a string in other words $output will not be filled.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
Also your cast to an array with json_decode with true is not necessary.

How to configure Authorize.Net webhooks

I have configured Authorize.net, accept hosted payment method for my client requirement, where everything is happening fine, except Transaction reponse. As per Authorize.net, response comes only either of these ways, webhooks or CommunicatorUrl. CommunicatorUrl not working for my code. so, opted for webhooks. Below is my code. please, suggest me something.
My doubts are:
My Code displaying this error when calling list of available webhooks
{
"status": 405,
"reason": "Method Not Allowed",
"message": "The requested resource does not support http method 'POST' for given parameters.",
"correlationId": "ff90ee25-0ba7-4006-bb1e-225ea64897e3"
}
Should i configure webhook anywhere in my Merchant Panel
How would i get my transaction response using webhook
<?php
$login_transKey = 'xxx:xxx'; //Login and Transaction Key of Authorize.net
$jsonObj = '{
"name": "Get WebHooks",
"request": {
"url": "http://localhost:81/hosted_payment_form/webhookstwo.php",
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
},
{
"key": "Authorization",
"value": "'.$login_transKey.'",
"description": ""
}
],
"body": {
"mode": "formdata",
"formdata": []
},
"description": ""
},
"response": []
}';
$jsonObj = json_encode($jsonObj);
$url = "https://apitest.authorize.net/rest/v1/eventtypes";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonObj);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false );
$content = curl_exec($ch);
echo '<pre>'; print_r($content); die();
curl_close($ch);
?>
Please, Let me know for more information.
You need to specify the webhook URL in authorize.net account.
Also you need to select the events in the settings page.
Please make sure that the Web-hook URL always return HTTP 200 response.
Otherwise it will be automatically changed to Inactive status.

Instagram API search by hastag

Im trying to search images related to a specific Hashtag in Instagram, but every time I try to validate or get permissions in my API client I see an alert that say we cant do public calls to show elements in my personal page.
I try with :
$url = "https://api.instagram.com/v1/tags/snowy/media/recent?access_token=".$TOKEN;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$json = curl_exec($ch);
curl_close($ch);
And return to me:
{"meta": {"error_type": "OAuthPermissionsException", "code": 400, "error_message": "This client has not been approved to access this resource."}}
This is related a API limitation? Preventing now using some API calls?

XBMC api get request in php with curl

I'm trying to do a GET request to the XBMC api in PHP, but i cant get it to work. I already have a valid url, thats working when i simulate a GET request with a REST client.
http://localhost:8085/jsonrpc?request={"jsonrpc": "2.0", "id": 1, "method": "Input.ExecuteAction", "params": {"action":"left"}}
I get a parse error from xbmc when i simulate a POST:
{
"error": {
"code": -32700,
"message": "Parse error."
},
"id": null,
"jsonrpc": "2.0"
}
This is the code i currently have:
<?php
$jsonString = "{\"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"Input.ExecuteAction\", \"params\": {\"action\":\"left\"}}";
$url = "http://localhost:8085/jsonrpc?request=".$jsonString;
get($url);
function get($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT , 7);
$result = curl_exec($ch);
print $result;
curl_close($ch);
}
But this wont do the job, just like when i simulate a POST request a parse error is returned.
So my thoughts are that i'm doing a POST request, am i?
If no, what would be the problem then?
I just ran into the same problem.
You need to encode the url you are using for XBMC (Kodi nowadays). So in your case:
$jsonString
should be replaced by
urlencode($jsonString)

Categories