Invalid JSON in influxdb-php - php

When a query is made, it retuns 404, invalid json error.
I use 8083 as port. Is there any another port for api.
Below is the code I use. Any help is welcome.
<?php
require '/vendor/autoload.php';
$client = new InfluxDB\Client('153.148.25.44', '8083');
$database = $client->selectDB('Meters');
$result = $database->getQueryBuilder()
->select('*')
->from('GDATA')
->limit(2)
->getResultSet()
->getPoints();
//$result = $database->query('select * from GDATAlimit LIMIT 5;');
//$points = $result->getPoints();
//$lastQuery = $client->getLastQuery();
echo '<pre>';
var_dump($result);
?>
Tested database connection, it is working.
Version is 0.13
Fatal error:
Uncaught exception 'InvalidArgumentException' with message 'Invalid JSON' in C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\ResultSet.php:30
Stack trace: #0 C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\Driver\Guzzle.php(100): InfluxDB\ResultSet->__construct('404 page not fo...')
#1 C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\Client.php(198): InfluxDB\Driver\Guzzle->query()
#2 C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\Database.php(78): InfluxDB\Client->query('Meters', 'SELECT * FROM "...', Array)
#3 C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\Query\Builder.php(261): InfluxDB\Database->query('SELECT * FROM "...')
#4 C:\xampp\htdocs\projectone\home.php(10): InfluxDB\Query\Builder->getResultSet()
#5 {main} thrown in C:\xampp\htdocs\projectone\vendor\influxdb\influxdb-php\src\InfluxDB\ResultSet.php on line 30

API port for InfuxDB v0.13 is 8086. I was using 8083, which is used for web.

Related

I want to fetch app data by package name in php

I am using google-play-scraper. but I am getting below error while using it.
Fatal error: Uncaught Error: Call to undefined method Symfony\Component\BrowserKit\Response::getStatus() in C:\xampp\htdocs\plystore\demo_123\google-play-scraper-master\vendor\raulr\google-play-scraper\src\Client.php:15 Stack trace: #0 C:\xampp\htdocs\plystore\demo_123\google-play-scraper-master\vendor\symfony\browser-kit\AbstractBrowser.php(401): Raulr\GooglePlayScraper\Client->filterResponse(Object(Symfony\Component\BrowserKit\Response)) #1 C:\xampp\htdocs\plystore\demo_123\google-play-scraper-master\vendor\raulr\google-play-scraper\src\Scraper.php(367): Symfony\Component\BrowserKit\AbstractBrowser->request('GET', 'https://play.go...') #2 C:\xampp\htdocs\plystore\demo_123\google-play-scraper-master\vendor\raulr\google-play-scraper\src\Scraper.php(108): Raulr\GooglePlayScraper\Scraper->request('/store/apps/det...', Array) #3 C:\xampp\htdocs\plystore\demo_123\google-play-scraper-master\examples\app.php(10): Raulr\GooglePlayScraper\Scraper->getApp('com.google.andr...') #4 {main} thrown in C:\xampp\htdocs\plystore\demo_123\google-play-scraper-master\vendor\raulr\google-play-scraper\src\Client.php on line 15
After getting this error I try the below solution.
Solution URL: https://github.com/raulr/google-play-scraper/issues/35
`[Change getStatus() to getStatusCode() ]
vendor\raulr\google-play-scraper\src\Client.php
Line: 15
$response->getStatus()
to
$response->getStatusCode()
vendor\raulr\google-play-scraper\src\Scraper.php
Line: 368
$status_code = $this->client->getResponse()->getStatus();
to
$status_code = $this->client->getResponse()->getStatusCode();`
but it did not work for me.

Submitting GetUserOofSettings and SetUserOofSettings request

Does anyone have any code about both getting and setting users OOF messages using Garethp/php-ews library by any chance?
(https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/aa563465(v=exchg.140))
(https://learn.microsoft.com/en-us/previous-versions/office/developer/exchange-server-2010/aa493825(v=exchg.140))
I have tried the following
use garethp\ews\API\Type;
use garethp\ews\MailAPI;
use garethp\ews\API\Enumeration\DistinguishedFolderIdNameType;
use garethp\ews\API\Enumeration\UserConfigurationPropertyType;
use garethp\ews\API\Enumeration\GetUserOofSettingsRequestType;
$email = 'me#mycompany.com';
$host = 'myexchserver'; $username = 'myusername'; $password = 'mypassword';
$api = MailAPI::withUsernameAndPassword($host,$username,$password,["version" => 'Exchange2010_SP1', 'impersonation' => $email]);
$response = $api->getClient()->GetUserOofSettingsRequest(['Address' => 'someuser#mycompany.com']);
But get the following error.
Fatal error: Uncaught SoapFault exception: [Client] Function ("GetUserOofSettingsRequest") is not a valid method for this service in /Scripts/vendor/garethp/php-ews/src/API/NTLMSoapClient.php:119 Stack trace: #0 /Scripts/vendor/garethp/php-ews/src/API/NTLMSoapClient.php(119): SoapClient->__call() #1 /Scripts/vendor/garethp/php-ews/src/API/ExchangeWebServices/MiddlewareFactory.php(18): garethp\ews\API\NTLMSoapClient->__call() #2 /Scripts/vendor/garethp/php-ews/src/API/ExchangeWebServices.php(510): garethp\ews\API\ExchangeWebServices->garethp\ews\API\ExchangeWebServices\{closure}() #3 /Scripts/vendor/garethp/php-ews/src/API/ExchangeWebServices/MiddlewareFactory.php(32): garethp\ews\API\ExchangeWebServices->garethp\ews\API\{closure}() #4 /Scripts/vendor/garethp/php-ews/src/API/ExchangeWebServices.php(510): garethp\ews\API\ExchangeWebServices->garethp\ews\API\ExchangeWebServices\{closure}() #5 /Scripts/vendor/garethp/php-ews/src/API/ExchangeWebServices/MiddlewareFactory.php(48): garethp\ews\API\ExchangeWebServices->garethp\ew in /Scripts/vendor/garethp/php-ews/src/API/NTLMSoapClient.php on line 119
Thanks

Google Drive API for PHP - How to connect?

I am just trying to connect my PHP with Google API. My aim is to fetch a particular folder's content and show them as feeds in my site. So for a base I am trying to pull the kind of file of my drive. I am struck. Here is my code.
<?php
require_once 'src/Google_Client.php';
require_once 'src/contrib/Google_DriveService.php';
$client = new Google_Client(); $client->setApplicationName("My Application");
$client->setDeveloperKey("<mykey>");
$service = new Google_DriveService($client);
$optParams = array('fields' => 'kind'); $results = $service->files->listFiles($optParams);
foreach ($results['files'] as $item) {
print($item['kind'].'<br>');
}
?>
When I execute this, I get the following error,
Fatal error: Uncaught exception 'Google_ServiceException' with message
'Error calling GET
https://www.googleapis.com/drive/v2/files?fields=kind&key=:
(403) Insufficient permissions for this file' in
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\src\io\Google_REST.php:66
Stack trace: #0
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\src\io\Google_REST.php(36):
Google_REST::decodeHttpResponse(Object(Google_HttpRequest)) #1
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\src\service\Google_ServiceResource.php(177):
Google_REST::execute(Object(Google_HttpRequest)) #2
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\src\contrib\Google_DriveService.php(465):
Google_ServiceResource->__call('list', Array) #3
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\test.php(12):
Google_FilesServiceResource->listFiles(Array) #4 {main} thrown in
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\src\io\Google_REST.php
on line 66
I gave proper key. Kindly help me. Thank you

search Google Calendar extendedProperties

I have the following problem when doing a privateExtendedProperty search
$service = new Google_CalendarService($client);
$extendedProperties = New Google_EventExtendedProperties();
$param = array();
$param['singleEvents'] = false;
$param['extendedProperties'] = "CodeID=66";
$events = $service->events->listEvents($calendarioId,$param);
Fatal error:
Uncaught exception 'Google_Exception' with message '(list) unknown parameter: 'extendedProperties'' in
..\google\service\Google_ServiceResource.php:111
Stack trace:
#0 ...\includes\google\contrib\Google_CalendarService.php(529): Google_ServiceResource->__call('list', Array)
#1 ...\google_calendario.php(198): Google_EventsServiceResource->listEvents('hude3h3fjolua08...', Array)
#2 ..\google_calendario.php(442): c_googlecalendario->proc_google('hude3h3fjolua08...', '66')
With the latest api on github you can do this:
$events = $service->events->listEvents($calendarId, array('privateExtendedProperty'=>'codeID='.$yourId));
Pay attention that it's either privateExtendedProperty or sharedExtendedProperty depending on how you created the event.

Zend_Gdata_addRecipientToEmailList Error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400

I have PHP code that is managing mailing lists using the Provisioning API. Visitors are able to opt in or out of the mailing list via a web form. It has been working for ~6 months and stopped working 10/1/2013.
I am using this code for testing:
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Gapps');
$service = Zend_Gdata_Gapps::AUTH_SERVICE_NAME ;
$username = 'my_username';
$password = 'my_password';
$domain = 'my_domain';
$email = 'test-email#domain.com';
$email_list = 'test-list';
$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);
$gdata = new Zend_Gdata_Gapps($client, $domain);
$gdata->addRecipientToEmailList($email, $email_list);
I'm receiving the following error message:
PHP Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400
Invalid request URI' in /usr/share/php/Zend/Gdata/App.php:716\nStack trace:
#0 /usr/share/php/Zend/Gdata.php(219): Zend_Gdata_App->performHttpRequest('POST', 'https://apps-ap...', Array, '<atom:entry xml...', 'application/ato...', NULL)
#1 /usr/share/php/Zend/Gdata/App.php(908): Zend_Gdata->performHttpRequest('POST', 'https://apps-ap...', Array, '<atom:entry xml...', 'application/ato...')
#2 /usr/share/php/Zend/Gdata/Gapps.php(247): Zend_Gdata_App->post(Object(Zend_Gdata_Gapps_EmailListRecipientEntry), 'https://apps-ap...', NULL, NULL, Array)
#3 /usr/share/php/Zend/Gdata/App.php(983): Zend_Gdata_Gapps->post(Object(Zend_Gdata_Gapps_EmailListRecipientEntry), 'https://apps-ap...', NULL, NULL, Array)
#4 /usr/share/php/Zend/Gdata/Gapps.php(840): Zend_Gdata_App->insertEntry(Object(Zend_Gdata_Gapps_EmailListRecipientEntry), 'https://apps-ap...', 'Zend_Gdata_Gapp...')
#5 /usr/share/php/Zend/Gdata/Gapps.php(1625): Zend_G in /usr/share/php/Zend/Gdata/App.php on line 716
Can anyone tell me what happened? And what I need to do to get this working again?
Thanks,
B
Google completely remove support for emaillists. Use groups instead lists.
Example:
instead $gdata->addRecipientToEmailList($email, $email_list)
use $gdata->addMemberToGroup($email, $group_name)
deleteEmailList -> deleteGroup
createEmailList -> createGroup
getEmailListRecipientFeed -> retrieveAllMembers
See full syntax in Zend docs:
http://framework.zend.com/manual/1.12/en/zend.gdata.gapps.html

Categories