Trying to use the php library for GA4 Admin - first thing to do is get a list of the accounts available to me. I have 5 analytics accounts under my... account:
Andy Test 1 (old google analytics account - <account id 1>)
Andy Test 2 (old google analytics account - <account id 2>)
Andy Test GA4 - 1 (GA4 account - <account id 3>)
Andy Test GA4 - 2 (GA4 account - <account id 4>)
Andy Test GA4 - 3 (GA4 account - <account id 5>)
I was hoping that this code would do it:
echo("Calling listAccountSummaries:");
foreach( $analyticsAdminServiceClient->listAccountSummaries() as $account_summary )
{
echo(" -- Name: {$account_summary->getName()}" );
echo(" -- Account: {$account_summary->getAccount()}" );
}
echo("End of listAccountSummaries");
What this gives me is:
Calling listAccountSummaries:
-- Name: accountSummaries/236841924
-- Account: accounts/236841924
End of listAccountSummaries
The "listAccounts" function isn't any better:
echo("Calling listAccounts:");
foreach ( $analyticsAdminServiceClient->listAccounts() as $account )
{
echo( " -- " . $account->getName() );
}
echo("End of listAccounts");
Output:
Calling listAccounts:
-- accounts/236841924
End of listAccounts
Why am I not seeing the other accounts? I would understand if these functions left out the older analytics accounts, but why not all 3 of the GA4 accounts?
Related
I've been following this tutorial: https://tsh.io/blog/grpc-php/
I have everything imported, however Im getting failed to parse binary descriptor in this file.
` $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
if (static::$is_initialized == true) {
return;
}
\GPBMetadata\Google\Protobuf\GPBEmpty::initOnce();
$pool->internalAddGeneratedFile(
'
�
bookstore.protoendpoints.examples.bookstore""
Shelf
id (
theme ( "1
Book
id (
author (
title ( "K
ListShelvesResponse4
shelves (2#.endpoints.examples.bookstore.Shelf"H
CreateShelfRequest2
shelf (2#.endpoints.examples.bookstore.Shelf"
GetShelfRequest
shelf ("#
DeleteShelfRequest
shelf ("!
ListBooksRequest
shelf ("F
ListBooksResponse1
books (2".endpoints.examples.bookstore.Book"T
CreateBookRequest
shelf (0
book (2".endpoints.examples.bookstore.Book"-
GetBookRequest
shelf (
book ("0
DeleteBookRequest
shelf (
book (2�
BookstoreZ
ListShelves.google.protobuf.Empty1.endpoints.examples.bookstore.ListShelvesResponse"f
CreateShelf0.endpoints.examples.bookstore.CreateShelfRequest#.endpoints.examples.bookstore.Shelf"`
GetShelf-.endpoints.examples.bookstore.GetShelfRequest#.endpoints.examples.bookstore.Shelf"Y
DeleteShelf0.endpoints.examples.bookstore.DeleteShelfRequest.google.protobuf.Empty"n
ListBooks..endpoints.examples.bookstore.ListBooksRequest/.endpoints.examples.bookstore.ListBooksResponse"c
CreateBook/.endpoints.examples.bookstore.CreateBookRequest".endpoints.examples.bookstore.Book"]
GetBook,.endpoints.examples.bookstore.GetBookRequest".endpoints.examples.bookstore.Book"W
DeleteBook/.endpoints.examples.bookstore.DeleteBookRequest.google.protobuf.Empty"B;
\'com.google.endpoints.examples.bookstoreBBookstoreProtoPbproto3',
true
);`
Googles suggestions have not helped. Im using this implemented into a laravel project with php8.1.
The code inside the internalAddGeneratedFile function was already there upon implementing the package.
Tried following the guide, followed many possible solutions on the interwebs to no avail.
Just trying to run a basic call to return all books.
PHP -> CODEIGNITER
Tables
- users [customers information]
- sms gateway [sms gateway configuration apiKey, sender code]
- sms template [ pre-approved dynamic templates eg, visitor to office]
Form
- fullname [input field] = SHREYAS
- Phone [input field] = 123456789
- service [dynamic dropdowm from services table] = ABC
- remark = QWERTY
** Form Submitted **
1) $post = $this->input->post(); [PHP codeigniter syntax for controller]
2) $data[] = $post[]; [all the form data is stored in array called data]
3) inserted data to db [visitors]
** sending sms to visitor **
1) $users_id = $this->session->userdata('users_id'); [PHP codeigniter syntax for getting users_id from session]
2) get_sms_gateway_details [of customer where users_id = $users_id]
3) $sms_content[users_id,sms_gateway_id,TITLE] // getting the template with users_id sms_gateway_id and title("visitors")
4) $sms_content is added in foreach loop to get visitors template message as string in $message
******** Problem I am facing ********
5) $message = Dear '.$post['fullname'],', Your request for '.$service_name.' is in progress. Our team will get back to you soon. Have a Great Day !!!. mob: +91
0000000000.
("this is the sms template used for visitors in which $post['fullname'] should be SHREYAS and $service_name = ABC" which was submitted in form above)
6) Final output required = Dear SHREYAS, Your request for ABC is in progress. Our team will get back to you soon. Have a Great Day !!!. mob: +91 0000000000.
7) later this will be added to sms_data_array[] and will be sent using PHP CRUL method
I'm dealing with a SOAP client response for a flight booking application, I successfully got the response, See the response below:
<arzoo__response>
<Response__Depart>
<OriginDestinationOptions>
<OriginDestinationOption>
<FareDetails>
<ChargeableFares>
<ActualBaseFare>4850</ActualBaseFare>
<Tax>4267</Tax>
<STax>31</STax>
<SCharge>0</SCharge>
<TDiscount>0</TDiscount>
<TPartnerCommission>0</TPartnerCommission>
</ChargeableFares>
<NonchargeableFares>
<TCharge>0</TCharge>
<TMarkup>0</TMarkup>
<TSdiscount>0</TSdiscount>
</NonchargeableFares>
</FareDetails>
<FlightSegments>
<FlightSegment>
<AirEquipType>321</AirEquipType>
<ArrivalAirportCode>DEL</ArrivalAirportCode>
<ArrivalDateTime>2013-05-20T08:00:00</ArrivalDateTime>
<DepartureAirportCode>BOM</DepartureAirportCode>
<DepartureDateTime>2013-05-20T06:00:00</DepartureDateTime>
<FlightNumber>601</FlightNumber>
<OperatingAirlineCode>AI</OperatingAirlineCode>
<OperatingAirlineFlightNumber>601</OperatingAirlineFlightNumber>
<RPH></RPH>
<StopQuantity>0</StopQuantity>
<airLineName>Air India</airLineName>
<airportTax>4267</airportTax>
<imageFileName>http://live.arzoo.com/FlightWS/image/AirIndia.gif</imageFileName>
<viaFlight></viaFlight>
<BookingClass>
<Availability>4</Availability>
<ResBookDesigCode>U</ResBookDesigCode>
</BookingClass>
<BookingClassFare>
<adultFare>4850</adultFare>
<bookingclass>U</bookingclass>
<classType>Economy</classType>
<farebasiscode>fjyS3YyUlEusLfJ4bwgPvQ==</farebasiscode>
<Rule>This fare is Refundable <br> Baggage : 25K<br>Booking Class : U|Re-Schedule Charges: Rs. 750 per sector + Fare difference (If any) +admin fee 500 + Service Fee of Rs. 250 Sector .|Cancellation Charges : Basic fare +Airline administration fee 500 + Service Charges 250 Per Passenger Per Sector . |</Rule>
<adultCommission>0</adultCommission>
<childCommission>0</childCommission>
<commissionOnTCharge>0</commissionOnTCharge>
</BookingClassFare>
<Discount>0</Discount>
<airportTaxChild>0</airportTaxChild>
<airportTaxInfant>0</airportTaxInfant>
<adultTaxBreakup>2800,147,1320</adultTaxBreakup>
<childTaxBreakup>0,0,0</childTaxBreakup>
<infantTaxBreakup>0,0,0</infantTaxBreakup>
<octax>0</octax>
</FlightSegment>
</FlightSegments>
<id>arzoo11</id>
<key>wtZcSVMY/gphWFSOTFWg8oKRnosq3p9wt7R4SjMB0EUK8sDjVS91GicTJzH+TWN+pNURIyTJYKOW O8yH8+0tzpA4t8aEEvzaOE6ZnTtBotFDwLtSiN0xXqMsaDl8diV51l7d9ata/3rxTgfh9d8ZSmFY VI5MVaDywdHNcjAR1vwnEycx/k1jftlsnmWWqYGnJxMnMf5NY36YIq2FtLkfcHtsd+IDEhxpxJuT v4YyS+QnEycx/k1jftlsnmWWqYGnJxMnMf5NY37ZbJ5llqmBpycTJzH+TWN+GlZsae+KA6L3dlms eLkXZFKXPvd5FAnBXnTfRGc5sz+UC8CsZNzDV2FYVI5MVaDyFiThuG7WKPhzqWDbQb1E1IqUKT5I FtF6OaCYjb6EFGhDwLtSiN0xXt7N3OmPGVH2v18OFlhFoI+A/uAfnTovYr9fDhZYRaCPgP7gH506 L2K/Xw4WWEWgj4D+4B+dOi9iv18OFlhFoI+A/uAfnTovYr9fDhZYRaCPgP7gH506L2K/Xw4WWEWg j4D+4B+dOi9iv18OFlhFoI/87KPqwdBsCm4nF4DlZwRNQ/zni8QE42g8S0GV1z3SJXaOdoTFisn9 v18OFlhFoI+ThOYsjNAbXEP854vEBONoPEtBldc90iVD/OeLxATjaAwTg0ygCEBmEgnKEhG4Md1D /OeLxATjaDxLQZXXPdIlQ/zni8QE42jXGTnbB/ydvR4daAuN34kWYVhUjkxVoPJtRWbi6bZrXL9f DhZYRaCPgP7gH506L2K/Xw4WWEWgj4D+4B+dOi9iv18OFlhFoI8KriAmVoEyR3OpYNtBvUTUp1Mf I240+obPusGaAOeuxg==</key>
</OriginDestinationOption>
</OriginDestinationOptions>
</Response__Depart>
</arzoo__response>
Now i have to display them as :
Base Price: 4850
Tax: 31
STax: 31
SCharge: 0
TDiscount: 0
TPartnerCommission: 0
.....................
Arrival Airport Code: DEL
.....................
I tried several methods using foreach():
$result = $client->__call('getAvailability',array($test));
$xml = simplexml_load_string($result);
foreach($xml->OriginDestinationOption as $od){
foreach($od->FareDetails as $fd){
foreach($fd->ChargeableFares as $cf){
echo $cf->ActualBaseFare;
}
}
}
but never sot it out. Can any one please help me out on this ?
Your help must appreciated. Thanks in advance
You are trying to access OriginDestinationOption as though it is a direct child of the XML response, but the structure is actually like this:
<arzoo__response>
<Response__Depart>
<OriginDestinationOptions>
<OriginDestinationOption>
So, since your $xml will represent the arzoo__response element, you need to traverse the other elements in between:
foreach($xml->Response__Depart->OriginDestinationOptions->OriginDestinationOption as $od)
I've an iphone app and a web app(in php ), i want to synchronize contacts in iphone app with database records.(from both device and web app ie. user can add/update/delete contacts from device or web app and both database will sync.)
Thanks
Use php-addressbook.sf.net, it includes a Exchange Interface to Sync your iPhone.
your question is not clear anyway I will give you some ideas
ABAddressBookRef addressBook = ABAddressBookCreate( );
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople( addressBook );
CFIndex nPeople = ABAddressBookGetPersonCount( addressBook );
for ( int i = 0; i < nPeople; i++ )
{
ABRecordRef ref = CFArrayGetValueAtIndex( allPeople, i );}
here the link for editing contacts and managing contacts
http://zcentric.com/2008/09/19/access-the-address-book/
https://developer.apple.com/library/ios/#samplecode/QuickContacts/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009475
I have a pagination script, which can be seen here:
http://www.automotori6282.tk/phpsandbox/
This is the source code:
http://pastebin.com/raw.php?i=63dCvfxD (PmcPagination.php)
http://pastebin.com/raw.php?i=3k4nqwRB (demo.php, the page with the code in)
and index.php for http://www.automotori6282.tk/phpsandbox/ simply uses PHP's include() function to show demo.php
What I'm trying to do is extract from two tables for the pagination.
This is my current database structure:
programme varchar(255)
channel varchar(255)
episode varchar(255)
series varchar(255)
setreminder varchar(255)
However, I have the episodes stored in a separate table, and would like to make a query which extracts from both epdata167 and episodes table (the episodes table only has episode, seriesno, episodeno and description as its fields).
One error I made in my pagination script shows here:
TV Show showing on Channel 1 August 3rd - 12:30pm "" Set Reminder
TV Show showing on Channel 1 August 3rd - 8:30pm "Episode 1" Set Reminder
and it still remains long after the event has happened.
This is how it should work:
TV Show showing on Channel 1 August 3rd - 12:30pm
TV Show showing on Channel 1 August 3rd - 2:45pm Set Reminder
TV Show showing on Channel 1 August 3rd - 8:30pm "Episode 1" Set Reminder
Notice how the Set Reminder field doesn't show when the event happens, and there's no quotation marks if an episode isn't selected.
(The setreminder field is basically a link that a user would click on to send a reminder to them saying "TV show is airing on Channel 1 August 3rd - 8:30pm Episode 1" or "TV show is airing today at 8:30pm Episode 1". However, it would not display for the show that is airing right now, it would display like this:
TV Show showing on Channel 1 August 3rd - 12:30pm
)
This is the pagination code causing trouble:
$result = mysql_query("SELECT programme, channel, airdate, expiration, episode, series, setreminder FROM epdata167 where airdate > curdate() GROUP by airdate");
and here is the part of the pagination code I edited to try and use an ifelse statement but wasn't sure what to do:
class paginationData {
private $program;
private $channel;
private $airdate;
private $exiration;
private $episode;
private $series;
private $setReminder;
public function __construct($program, $channel, $airdate, $expiration, $episode, $setReminder)
{
$this->program = $program;
$this->channel = $channel;
$this->airdate = strtotime($airdate);
$this->expiration = $expiration;
$this->episode = $episode;
$this->setReminder = $setReminder;
}
//This function shows the data
public function display()
{
if(date('Y-m-d') == date('Y-m-d', $this->airdate)) $dateFormat = 'g:ia';
elseif(date('Y') == date('Y', $this->airdate)) $dateFormat = 'F jS - g:ia';
else $dateFormat = 'F jS, Y - g:ia';
echo '<tr>'."\n".
' <td><strong>'.$this->program.'</strong></td>'."\n".
' <td>showing on '.$this->channel.'</td>'."\n".
' <td>'.date($dateFormat, $this->airdate).'</td>'."\n".
' <td><b>"'.$this->episode.'"</b><br></td>'. "\n".
' <td>'.$this->setReminder.'</td>'."\n".
'</tr>'."\n";
}
}
Basically, I'm having trouble trying to get data as this in my project:
TV Show showing on Channel 1 August 3rd - 12:30pm
TV Show showing on Channel 1 August 3rd - 2:45pm Set Reminder
TV Show showing on Channel 1 August 3rd - 8:30pm "Episode 1"
Series 1, episode 1 Set Reminder
(that's if the episode is part of a series with a series number)
Not sure what JOIN to use and where, all help is appreciated trying to get this to work since I've got the pagination working; just trying to get the finer details working!
I'm not asking for people to do it for me, I've been learning myself, and have done my research.
Sorry if this seems a bit long, but I hope I've explained it all.
Thanks.
You need to use a UNION to get this to work.