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.
Related
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.
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 working with the Church Community Builder API (official docs, search for "group profile" to see relevant code) and with CCB Core WordPress Plugin to sync groups data from the API into custom post types (fields, taxonomies).
CCB Core maps a lot of this data automatically, but it doesn't map the group ID value CCB uses to distinguish one group from another and I'd like to sync it.
The relevant code is kept in the functions get_groups_custom_fields_map() and get_groups_taxonomy_map().
I've tried adding something like the following to get_groups_taxonomy_map():
'group_id' => array (
'api_mapping' => 'group',
'data_type' => 'integer',
),
But this doesn't work. Any suggestions on writing code to pull in this field?
UPDATE 9/10/16 7:25 PM:
I think I am wicked close.
I took the XML from the API documentation under Group Profile and ran it through simplexml and generated this output.
I then compared the output with how the get_groups_custom_fields_map and get_groups_custom_taxonomy_map was organized, which led me to believe the following should work:
'group' => array (
'api_mapping' => 'group',
'data_type' => 'object',
'child_object' => array(
'api_mapping' => '#attributes',
'data_type' => 'object',
'child_object' => array(
'group_id' => array(
'api_mapping' => 'id',
'data_type' => 'integer'
)
)
)
),
But it doesn't. What am I missing?
The SimpleXML representation of the response that comes back from CCB just so happens to have a really frustrating way of deserializing the IDs for the entities (Groups, Events, Individuals, etc) that come out of the API. (And it only happens on the IDs).
Even though Group ID looks like a property in the XML response string, it's actually an attribute which is slightly different. In your object response, notice that # symbol in the [#attributes] node. PHP will not allow direct access to that.
See "At sign" # in SimpleXML object?
As a workaround I actually obtain the Group ID like so right here:
https://github.com/jaredcobb/ccb-core/blob/1a6e88b47ad7d5293e88bac277e72cbc4e33a602/admin/class-ccb-core-sync.php#L589-L595
Code snippet of the above reference:
$group_id = 0;
foreach( $group->attributes() as $key => $value ) {
if ( $key == 'id' ) {
$group_id = (int) $value;
break;
}
}
So in general, we do have access to that group id, we just need to now save it as post meta. I'll update the plugin to take advantage of these IDs, but in the mean time you can use the $group_id variable directly and save the post meta in this function.
I'm using the PHP sdk to do image searches
$service = new Google_Service_Customsearch($client);
$optParams = array(
'imgType' => 'photo',
'imgColorType' => 'color',
'imgSize' => 'large',
'searchType' => 'image',
'num' => '5',
'safe' => 'medium',
'rights' => '(cc_publicdomain|cc_attribute|cc_sharealike)',
'filter' => '1',
'cx' => <my cx>,
);
$results = $service->cse->listCse($query, $optParams);
but i'm unclear that the "rights" field is doing anything.
It seems to generating a curl request that looks like this...
https://www.googleapis.com/customsearch/v1?
q=<query here>
&imgType=photo
&imgColorType=color
&imgSize=large
&searchType=image
&num=6
&safe=medium
&rights=%28cc_publicdomain%7Ccc_attribute%7Ccc_sharealike%29
&filter=1
&cx=<my cx>
but i'm not clear that is working the way i expect. my query returns different images then when I use the web form.
Additionally the docs unhelpfully states..
rights | string | Filters based on licensing. Supported values include:
| | cc_publicdomain, cc_attribute, cc_sharealike, cc_noncommercial,
| | cc_nonderived, and combinations of these.
however i never get an error with this field, i can put any junk i want into it.
what is the proper format google expects here? comma delimited? array? piped ?
Also, the options listed in the docs do not seem to match up precisely with the options in the web form, and some insights there would be nice too.
You can see here for licencing of custom search
https://developers.google.com/custom-search/docs/structured_search#licensing
My question relates to pulling data from a remote source and saving it to a local database. With the saveAll(), the parent data gets saved correctly, but not the child data.
protected function _saveLocal($_rekeyedData) {
//Set the invoice header and line items models
if (!isset($this->LocalHeader)) {
$this->loadModel('LocalHeader');
$this->LocalHeader->create();
// $this->LocalHeader->set($_rekeyedData);
if (!isset($this->LocalDetail)) {
$this->loadModel('LocalDetail');
$this->LocalDetail->create();
}
}
if ($this->LocalHeader->saveAll($_rekeyedData, array('validate' => 'first'))) {
$this->Session->setFlash('Your data has been saved.');
} else {
$this->Session->setFlash('Data load failed.');
}
debug( $this->LocalDetail->invalidFields() );
}
In this function, I load the models, then attempt to saveAll(). A sample record looks like this:
[1] => Array
(
[LocalHeader] => Array
(
[SOPNUMBE] => CR014076
[DUEDATE] => 2012-04-10 00:00:00
[DOCDATE] => 2012-04-10 00:00:00
[DOCAMNT] => 12000.00000
[SUBTOTAL] => 12000.00000
)
[LocalDetail] => Array
(
[0] => Array
(
[ITEMNMBR] => BASIC SERVICE
[QUANTITY] => 1.00000
[UOFM] => EA
[UNITPRCE] => 12000.00000
[TAXAMNT] => .00000
[CONTSTARTDTE] => 1900-01-01 00:00:00
[CONTENDDTE] => 1900-01-01 00:00:00
[SOPNUMBE] => CR014076
)
)
)
All that gets saved is the LocalHeader record. My hunch is that it has something to do with the array('validate' => 'first'). I think I need to do something separate like validateMany when using saveAll(), but I can't remember where I saw something like that or if I just made it up.
I've read many of the related questions in SO, but none of the offered solutions worked for me.
Any help is appreciated. Please feel free to ask if you have any questions.
EDIT:
This is the header model and this is the detail model.
I think the issue is that neither of those records exists yet. According to the docs
If neither of the associated model records exists in the system yet
(for example, you want to save a new User and their related Profile
records at the same time), you’ll need to first save the primary, or
parent model.
You can read more here with an example.