How to get following date of the followers on twitter using php - php

I need to create line chart for my twitter followers . I have used following code to list the followers details.
$parameters = array('include_user_entities' => true);
$response = $this->api->get('followers/list.json', $parameters);
Its working fine .But its doesn't probvide following date details. How can I get following date details using twitter api

If you write:
$parameters = array('include_user_entities' => true);
$parameters = array();
The second command overwrite the first. Thus $parameters contains an empty array. Try with this:
$parameters = array('include_user_entities' => true);
$response = $this->api->get('followers/list.json', $parameters);

There is no way in the API to tell when someone followed you.
Take a look at the API reference - https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-followers-list
The only date in the returned object is created_at - that refers to when the account was created, not when it followed you.

Related

how to read results from aws s3 headObject using PHP SDK v2?

I am able to successfully get results back from a call to headObject like this. But then I can't access what's in $result as result is an object (Guzzle\Service|Resource\Model) and the data I see in it is obviously in protected variables meaning I have to use an object call to get it. But how do I know what the method call should be?
$result = $client->headObject([
'Bucket' => $bucket, // REQUIRED
'Key' => $key // REQUIRED
]);
$relevantmetaData = array();
$relevantmetaData['LastModified'] = $result->data['LastModified'];
The link here doesn't mention a method to get at $data
I guess I should just have tried get(), it works.
$relevantmetaData['LastModified'] = $result->get('LastModified');

Laravel LengthAwarePaginator returned data are not in single obejct

So i have made a custom pagination in laravel 5.4 using
Illuminate\Pagination\LengthAwarePaginator;
\Illuminate\Pagination\Paginator;
it returns the correct data and format during first request, but the 2nd request and others are not formatted same way as the first one.
So my question is how do I make the data to always return in a single object like the first request?
Below is my code on how I did my custom paginator and the console log.
$data = collect($playerMatchArr);
$result = new LengthAwarePaginator(
$data->forPage($page, 3),
$data->count(),
$limit,
$page
);
It is laravel json response which is doing this. I also spent couple of hours on it
finally managed to convert the response on the front end by receiving the response as
Object.values(response.data.data)
And finally i got the results
$data = collect($playerMatchArr);
$dataPerPage = $data->forPage($page, 3);
$dataPerPage = array_values($dataPerPage->toArray());
$dataPerPage = Collection::make($dataPerPage);
$result = new LengthAwarePaginator(
$dataPerPage,
$data->count(),
$limit,
$page
);

iterate an array in my jrxml file without using a datasource

I'm using jasperserver in my php/Symfony to generate my reports, and i pass parameters ad everything works fine. But now i want to pass an array containing the list of my user's name to jrxml file i really don't know if it's possible. i mean i know that we can do it with javabeans or creating a datasource, but in my case i mustn't use a database plus i use php.
So if anyone know how to pass the array and fetch it in the jrxml file to display all the values i would be so grateful
so here is the code i'm want to use
$users = $em->getRepository('UserBundle:Utilisateur')->getAll();
$params = array(
"montantEnLettre" => $montantEnLettre,
"policeGroupeLibelle" => $contrat->getProduit()->getLibelle(),
"montanttotal" => $contrat->getMontantTotale(),
"utilisateurs" => $users
);
$d = new Client(
"http://127.0.0.1:8080/jasperserver",
"jasperadmin",
"jasperadmin"
);
$js = $d->jobService();
$d->setRequestTimeout(60);
$info = $d->serverInfo();
$report = $d->reportService()->runReport('/reports/epargne', 'pdf',null,null,$params);
I don't know if i can pass the users as a parameter and i have no idea how to fetch it my jrxml file

limelight api paging with media method

I'm using the limelight content API to retrieve all of my videos.
I used their examples and it is returning all media.
Here is the code:
$request = "http://api.video.limelight.com/rest/organizations/$org_id/media/search";
$signed_request = LvpAuthUtil::authenticate_request("GET", $request, $access_key, $secret, $params);
Now I want to tell it which field to sort the results by. The documentation says that there are paging parameters available, but I can't seem to get them to work.
I tried adding $params = array("and" => "sort_by:title");
and $params = array("sort_by" => "title"); but neither worked.
I also tried adding it to the url but it didn't work. http://api.video.limelight.com/rest/organizations/$org_id/media/search?sort_by=title
Can someone tell me how to pass the paging parameters correctly?
Thank You
Try this:
http://api.video.limelight.com/rest/organizations/6d4242bd0cf94083a0195bfc2083e46e/media.xml?page_id=0&page_size=50&sort_by=publish_date&sort_order=desc
Check optional parameter in List all channels that contain a specific media
Optional Parameters
page_id = <The zero-based identifier of the page to return>
page_size = <The number of results to return per page> (default/max: 500)
sort_by = <The field by which the results should be sorted> {publish_date, create_date, update_date} (default: update_date)
sort_order = <The order in which the results should display> {asc, desc} (default: asc)

How to update chargify next_billing_at value using php api?

I'm using the php chargify connector described at https://github.com/jforrest/Chargify-PHP-Client and I would like to update the next_billing_at parameter of a subscription. I tried doing it like this:
$requestArr = array('customer_id'=>"$thisCustomerID",'next_billing_at' => '2013-04-20T02:52:17-04:00');
try {
$connector->requestUpdateSubscription($thisSubscriptionID, json_encode($requestArr), $format = 'JSON');
} catch (ChargifyValidationException $cve) {
//process error handling code here.
echo $cve->getMessage();
}
But although there are no validation exceptions, when I check the next assessment date right afterwards it is unchanged:
$subscriptionUpdated = $connector->getSubscriptionsByID($thisSubscriptionID);
$newBillingDate = $subscriptionUpdated->next_assessment_at;
echo "new next billing date is $newBillingDate<br>";
I tried passing the date as just '2013-04-20' but that didn't work either. Is it possible to update the billing dates in chargify using the API?
You've got the right idea, except your array should look like:
$requestArr = array(
'subscription' => array(
'customer_id' => $thisCustomerID,
'next_billing_at' => '2013-04-20'
)
);
and then you should be good (tested)
reference: http://docs.chargify.com/api-subscriptions#api-usage-json-subscriptions-update

Categories