I am targeting to load Google Jobs search result in my custom website.
So for that I created account on google and enable Google Talent API. After enable billing on google cloud API account, they allow me request to this API using API Key and Service account credentials.
I am currently using PHP with the use of api-client-php library.
For that I have download .json file for credential (client_secret.json) from google Console Talent Platform.
Here is my sample code in PHP.
require 'vendor/autoload.php';
// Instantiate the client
$client = new Google_Client();
$api_key = 'AdsadsIzaSyBYAMxEPPasdadadw5VHITCdREQW7WYeIGs8jRlUYqlzLM';
$client->setDeveloperKey($api_key);
$client->setAuthConfig(getcwd() . '/client_secret.json');
$client->setScopes(array(
'https://www.googleapis.com/auth/jobs',
'https://www.googleapis.com/auth/cloud-platform'
));
$jobs = new Google_Service_JobService($client);
$location='USA';
// Set the Metadata
$requestMetadata = new Google_Service_JobService_RequestMetadata();
$requestMetadata->setUserId('000aaaa');
$requestMetadata->setSessionId('000aaaa-1212-21212');
$requestMetadata->setDomain('www.google.com');
$jobQuery = new Google_Service_JobService_JobQuery();
$keyword='software OR java';
$jobQuery->setQuery($keyword);
// Search Job Request
$searchRequest = new Google_Service_JobService_SearchJobsRequest();
$searchRequest->setRequestMetadata($requestMetadata);
$searchRequest->setQuery($jobQuery);
$searchRequest->setMode('JOB_SEARCH');
$jobService = new Google_Service_JobService($client);
$response = $jobService->jobs->search($searchRequest);
echo "<pre>";
print_r($response);
print_r($response->matchingJobs);
While sending this request, We are getting matchingjobs blank array but $response have some object array. which is something like not output but just request information.
here is the response which we are getting so far using Talent Search API.
Google_Service_JobService_SearchJobsResponse Object
(
[collection_key:protected] => matchingJobs
[appliedCommuteFilterType:protected] => Google_Service_JobService_CommutePreference
[appliedCommuteFilterDataType:protected] =>
[appliedJobLocationFiltersType:protected] => Google_Service_JobService_JobLocation
[appliedJobLocationFiltersDataType:protected] => array
[estimatedTotalSize] =>
[histogramResultsType:protected] => Google_Service_JobService_HistogramResults
[histogramResultsDataType:protected] =>
[jobView] =>
[matchingJobsType:protected] => Google_Service_JobService_MatchingJob
[matchingJobsDataType:protected] => array
[metadataType:protected] => Google_Service_JobService_ResponseMetadata
[metadataDataType:protected] =>
[nextPageToken] =>
[numJobsFromBroadenedQuery] => 0
[spellResultType:protected] => Google_Service_JobService_SpellingCorrection
[spellResultDataType:protected] =>
[totalSize] =>
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
[metadata] => Google_Service_JobService_ResponseMetadata Object
(
[collection_key:protected] => experimentIdList
[experimentIdList] => Array
(
[0] => 11300310
[1] => 11300342
)
[mode] => JOB_SEARCH
[requestId] => f5cacd36-db29-4d65-851f-34a97c98af79:APAb7IRQAVop4QZ6rC2OlKjcEARRJQHI8w==
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
)
)
Array
(
)
I am confuse here, Talent API can search and load google Jobs on our website OR we need to create company and jobs and they just provide Advanced search filter using AI and ML ?
Lets if they provide google Jobs on our website then what is wrong in my code ?
Please suggest me.
Google's Talent API only works with data you provide it, so yes, you should create companies and jobs and then apply the searches to those jobs.
The second step in the checklist they've published for launching apps that use this API is Index companies and jobs, with clear mentions of these being from your own database:
Create at least one Company. We recommend creating Company objects for
all companies in your database with open jobs.
Create Jobs for your Companies. We recommend creating Job objects for
all open jobs in your database.
Additional proof that supports this disappointing reality is an article published by Ivan Davchev after the Google conference where this API was announced:
What Is Google Jobs API?
It is a turn-key solution to searching your jobs. Like most cloud-based search > solutions, you need to feed it documents (jobs) which it indexes and makes searchable.
[...]
It is not an aggregator and does not offer “all jobs in the world” out of the box. > So you can’t build an Indeed competitor in an afternoon with this API. It only searches > what you provide it, which is why it makes sense for job boards and applicant tracking > systems (ATS) to use it — jobs are posted on and managed by those systems.
Related
I have implemented the Google API in PHP as a service and using the Google_Service_ServicePeople() to add a contact. That works and I am getting back a proper result as a paople object. In addition when I call the people_connections->listPeopleConnections method I am getting back the contacts that I have created in my tests. However, when I go to contacts.google.com no contact will be shown.
Maybe it is a missunderstanding from my site, but I thought that based on the appsettings on my account, the new contacts will be created (added) to my account, won't they?
$client = new Google_Client();
$client->setApplicationName ('VABS-CONTACT-TEST');
$client->setAuthConfig($_SERVER['DOCUMENT_ROOT'].'/includes/classes/Google/auth.json');
$client->addScope (Google_Service_Peopleservice::CONTACTS);
$peopleService = new Google_Service_PeopleService($client);
$person = new Google_Service_PeopleService_Person();
$name = new Google_Service_People_Name();
$name->setDisplayName ('FirstName LastName');
$name->setFamilyName ('LastName');
$name->setGivenName('FirstName');
$email = new Google_Service_People_EmailAddress();
$email->value = 'xxx#xxx.xx';
$person->setNames ($name);
$person->setEmailAddresses ($email);
$result = $peopleService->people->createContact ($person);
The response looks like:
Google_Service_PeopleService_Person Object
(
[collection_key:protected] => userDefined
[addressesType:protected] => Google_Service_PeopleService_Address
[addressesDataType:protected] => array
[ageRange] =>
[ageRangesType:protected] => Google_Service_PeopleService_AgeRangeType
[ageRangesDataType:protected] => array
[biographiesType:protected] => Google_Service_PeopleService_Biography
[biographiesDataType:protected] => array
[birthdaysType:protected] => Google_Service_PeopleService_Birthday
[birthdaysDataType:protected] => array
[braggingRightsType:protected] => Google_Service_PeopleService_BraggingRights
[braggingRightsDataType:protected] => array
[coverPhotosType:protected] => Google_Service_PeopleService_CoverPhoto
[coverPhotosDataType:protected] => array
[emailAddressesType:protected] => Google_Service_PeopleService_EmailAddress
[emailAddressesDataType:protected] => array
[etag] => %Eh8BAgMEBQYHCAkKCwwNDg8QERITFBUWFzUZNDciJScuGgwBAgMEBQYHCAkKCwwiDFFrVXd2SnRpTFZZPQ==
[eventsType:protected] => Google_Service_PeopleService_Event
[eventsDataType:protected] => array
[gendersType:protected] => Google_Service_PeopleService_Gender
.
.
.
.
(
)
[modelData:protected] => Array
(
[metadata] => Array
(
[sources] => Array
(
[0] => Array
(
[type] => CONTACT
[id] => 494c65970e1a12eb
[etag] => #QkUwvJtiLVY=
[updateTime] => 2018-04-04T13:58:27.710001Z
)
...
Using the
$peopleService->people_connections->listPeopleConnections('people/me',$options)
lists all the created contacts as expected.
But on my contacts.google.com page no contact will be shown. I am logged in as the same user I have created and granted access to the API.
Any ideas, hwy the contacts won't be shonw on contacts.google.com?
Many thanks!
After several tries it wasn't possible for me to get it solved. Therefore I have tried it now via the RapidWeb Solution. Now it is working and "the setup" with a guide - even though it tooks also 3 steps of getting the right account in place - is simple.
The main problem I had is to understand the logfic of OAuth2 and their possibilities to setup the correct OAuth2 Client.
In my case I needed to setup a Native Client (just choose "Other" as ApplicationType on the second screen in the Google API Console after creating a new OAuth2 ClientId)
Anyway. Many thanks for all who tried to help me! Much appreciated!
Cheers!
i am trying to get user activity via aweber rest api using thier aweber php library.
code:
$all_subscribers = $account->findSubscribers($params);
foreach ($all_subscribers as $sub) {
echo "<p><strong>Name:</strong> {$sub->name}</p>";
echo "<p><strong>Email:...;
foreach ($sub->getActivity() as $event) {
echo "<p>{$event->type}: {$event->event_time}</p>";
}
}
i am able to get the details such as event type and event timing but i also need to fetch title and the url of the message on which the events were happened.
i also tried $event->self_link but it was no help.
Here is the data return by getActivity() method
[data] => Array
(
[event_time] => 2017-04-30 07:05:00-04:00
[resource_type_link] => https://api.aweber.com/1.0/#open
[http_etag] => "28eb617e4d24407e49b14a9402608f423da2f4a7-ca5feee2b7fbb6febfca8af5541541ea960aaedb"
[subscriber_link] => https://api.aweber.com/1.0/accounts/1011749/lists/4120909/subscribers/59065294
[self_link] => https://api.aweber.com/1.0/accounts/1011749/lists/4120909/campaigns/f28501689/messages/40127/opens/15096
[type] => open
[id] => 15096
)
Hello i want to find open houses property using PHP RETS script. i have did below code in which i am able to find Open Houses Property details like MLS_Number,From-date,To time but i am not able to get based on MLS_Number find property other details like address,price,room No and other details. what i have tried so far below is code.
$retsFilters['IS_ACTIVE '] = true;
$retsQuery = '';
foreach ($retsFilters as $key => $value) $retsQuery .= ',('.$key.'='.$value.')';
$retsQuery = trim($retsQuery, ',');
$result = $rets->SearchQuery("openhouse", "OpenHouse",$retsQuery,array('Format' => QUERY_FORMAT));
from above code returns only
Array
(
[AdvertOpenHouse] => 1
[Agent_MUI] => 2871
[Description] =>
[FromDate] => 2016-09-01T00:00:00.000
[FromTime] => 1400
[InputDate] =>
[IS_ACTIVE] => 1
[IsDeleted] => 0
[Listing_MUI] => 9985949
[listing_type] => RE
[matrix_unique_ID] => 10268565
[mls_number] => 548766
[ModificationTimestamp] => 2016-01-08T13:31:23.390
[Open_House_Refreshments] =>
[ToTime] => 1600
)
but i want also more property's details like address,streetName,city,price and other details.
this is the my login url http://rets.saskmls.ca/rets/login.ashx
if any one have idea please help thanks in advance.
Well the Openhouse Resource and underlying classes would not contain this kind of information. There should be a Property Resource with many different kinds of property classes within (Residential, Commercial, Land, etc...)
You need to examine the metadata from the RETS server, it will contain XML that describes all the available Resources, Classes and fields.
Note the signature of the SearchQuery method:
SearchQuery ( string $resource, string $class, string $query [, array $options] )
Your resulting query would look something like this:
SearchQuery("Property", "RES", "(Status=|A)")
I am using Paragon as a MLS back-end provider. When I get an "OpenHouse" resource, there's a field called
L_DisplayId
which is present in "Property" resources.
This field makes a relationship between the two resources.
Once you know L_DisplayId value from an open house, you can search for a property sending L_DisplayId as a search parameter.
Hope that can help you.
My app uses CakePHP (2.2.5) to get data from a SOAP server. I put logging into the SoapSource.php connector to see the XML returned and to display the array returned:
$result = $this->client->__soapCall($method, array('parameters' => $tParams));
Logger::write('SOAP Last Response', $this->client->__getLastResponse(), 3, 'transaction');
Logger::write('SOAP Last Response Object', print_r($result, TRUE), 3, 'transaction');
But what I'm seeing in the log is that two (recently-added) fields present in the XML are missing from the array, specifically, the last two before the RPList (formatted here but otherwise verbatim):
<transactionResult>
<id>test</id>
<resultCode>0</resultCode>
<ReadScheduledRecordingsRsp>
<RecordingDefinitionList>
<RecordingDefinition>
<RDId>d8c16d8f-67c6-469a-83c3-d51d8f8859a9</RDId>
<Title>The Young and the Restless</Title>
<SeriesId>4422</SeriesId>
<KeepUntil>SpaceIsNeeded</KeepUntil>
<StartPadSeconds>0</StartPadSeconds>
<EndPadSeconds>0</EndPadSeconds>
<Frequency>EveryDay</Frequency>
<KeepAtMost>0</KeepAtMost>
<Priority>23</Priority>
<ShowType>Any</ShowType>
<AirtimeDomain>SpecificTime</AirtimeDomain>
<ChannelDomain>SpecificChannel</ChannelDomain>
<RPList>
...
Followed by:
ARRAY
(
[transactionResult] => stdClass Object
(
[id] => test
[resultCode] => 0
[ReadScheduledRecordingsRsp] => stdClass Object
(
[RecordingDefinitionList] => stdClass Object
(
[RecordingDefinition] => Array
(
[0] => stdClass Object
(
[RDId] => d8c16d8f-67c6-469a-83c3-d51d8f8859a9
[Title] => The Young and the Restless
[SeriesId] => 4422
[KeepUntil] => SpaceIsNeeded
[StartPadSeconds] => 0
[EndPadSeconds] => 0
[Frequency] => EveryDay
[KeepAtMost] => 0
[Priority] => 23
[ShowType] => Any
[RPList] => stdClass Object
(
...
I'm guessing I just forgot or didn't know to do something, but I don't know what. It's just very suspicious that the two fields that don't work are the two that were just added, but I can't find any place where the fields are enumerated.
The WSDL doesn't specify any fields at all, just that there will be a bunch of data inside a transactionResult.
In the connect call, the options likewise don't specify any fields.
It all worked fine until the back-end added those two fields, and it all still works fine, except that I can't see the 2 new fields in the object.
Any ideas?
It would be nice to see the XML for RPList. What version of PHP/libxml?
Have you actually validated the XML returned by __getLastResponse()?
It sounds to me like your using WSDL mode for the client but your WSDL file lacks precision. Try using a WSDL which actually describes the data being served up by the API.
Am I understanding that the $result object when dumped lists RPList but the value is not what you expect? If so you might be able to get away with adding the SOAP_SINGLE_ELEMENT_ARRAYS option to the clients constructor: new SoapClient($wsdl, array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));. That's a long shot though. Need to see WSDL and full output from __getLastResponse().
Any errors? Try wrapping the call like so:
try {
$client = new SoapClient ('http://yoursite.com?WSDL',
array("trace" => 1,
"exceptions" => true,
"cache_wsdl" => WSDL_CACHE_NONE,
"features" => SOAP_SINGLE_ELEMENT_ARRAYS)
);
$result = $client->SomeMethod($data);
} catch (SoapFault $exception) {
var_dump($exception);
} catch (Exception $exception) {
var_dump($exception);
}
Short of fixing the WSDL/XML response your workaround seems like the best solution.
I'm developing my first Facebook app in PHP and was wondering if the page on Facebook that it's being viewed in can be detected by the app. I'm planning on displaying the app on several different pages and want the app to display something different for each of the pages. This way I would only the need the user to accept the permissions for one central app instead of several different ones.
Yes. There is signed_request (POST), with Page ID... You cannot get entire URL because request is going trough Facebook proxy. Here is the way how you can do it, later just serve content based on Page ID...
$signed_request = $_POST['signed_request'];
$response = Facebook::parse($signed_request);
$page_id = $response['page']['id'];
(this is just the part of my class)
class Facebook {
// Facebook signed request parser
public static function parse($signed)
{
list($encoded, $payload) = explode('.', $signed, 2);
$sig = Facebook::base64_url_decode($encoded);
$data = json_decode(Facebook::base64_url_decode($payload), true);
if(strtoupper($data['algorithm']) !== 'HMAC-SHA256'){
error_log('Unknown algorithm. Expected HMAC-SHA256');
return false;
}
return $data;
}
// Base64 decode for Facebook
private static function base64_url_decode($input)
{
return base64_decode(strtr($input, '-_', '+/'));
}
}
edit:
Like you have said, you need to authorize app only once per user, and you will be able to use it across all pages (I have hundreds of them). This is output of signed_request when user is "connected" to app.
Array
(
[algorithm] => HMAC-SHA256
[expires] => 0
[issued_at] => 1311062412
[oauth_token] =>
[page] => Array
(
[id] => 149715315100385
[liked] => 1
[admin] => 1
)
[user] => Array
(
[country] => ba
[locale] => en_US
[age] => Array
(
[min] => 21
)
)
[user_id] => 1368368917
)
You can see page->id, a user_id, also you will get token for accessing user info (for those you have permission).
You set this location in the developer application when you create your first app. Go to facebook.com/developers and create a new app and you will be able to set the location of your canvas application, which is then loaded in app.facebook.com/YOUR_APP_NAME.