Closed mahmoud-m-abadi closed 7 years ago
I'm guessing that for your $images
, there aren't actually any, so calling first()
returns null and then you call isError()
on that. It's probably best to wrap that in an if (count($images))
check before proceeding
@steveheinsch Yes, actually I already used this method. Thanks!
Hey sir.
We have a problem that can not be solved, so we ask you for help 。
First of all, we have MLS accounts that you got from them. They are:
$rets_login_url = "https://pt.rets.crmls.org/contact/rets/login";
$rets_username = "**FANG";
$rets_password = '**!y$jTv';
I can make sure this account is available,I can make sure this account is available, because I can get the data through this account(That is the basic information Housing),
I got the data through this phprets 1.x and put it in the CSV, which is what we need。
I see your document is using this method: GetObject ("property", "photo", "*", "1") ,to get the picture.
There are a lot of mlsid fields involved in CSV, but I don't know which field to associate to get the corresponding picture.
So please help me, thank you very much!!!
Good nice to you!!!
------------------ 原始邮件 ------------------ 发件人: "mahmod2000";notifications@github.com; 发送时间: 2017年8月26日(星期六) 晚上9:37 收件人: "troydavisson/PHRETS"PHRETS@noreply.github.com; 抄送: "Subscribed"subscribed@noreply.github.com; 主题: Re: [troydavisson/PHRETS] Fatal error: Call to a member functionisError() on null (#165)
@steveheinsch Yes, actually I already used this method. Thanks!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hi @1014825794 Actually CRMLS returns the images in another resource called Media, rather than 'property'. So you need to get 'ListingKeyNumberic' and make a search in MLS data with 'Media' in resource and class parameters.
Regards,
Thank you very much, and I need to use that method in order to get the picture. I've got the data and put it in the CVS. It has ListingKeyNumberic, Thanks!!!
------------------ 原始邮件 ------------------ 发件人: "mahmod2000";notifications@github.com; 发送时间: 2017年9月11日(星期一) 中午12:47 收件人: "troydavisson/PHRETS"PHRETS@noreply.github.com; 抄送: "浪子小风"1014825794@qq.com; "Mention"mention@noreply.github.com; 主题: Re: [troydavisson/PHRETS] Fatal error: Call to a member functionisError() on null (#165)
Hi @1014825794 Actually CRMLS returns the images in another resource called Media, rather than 'property'. So you need to get 'ListingKeyNumberic' and make a search in MLS data with 'Media' in resource and class parameters.
Regards,
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
In fact, I have already got the media contents, which are related to the information, there is this mediaURL image links, but why only a picture, can you tell me, which you say some fields, thank you!!!
------------------ 原始邮件 ------------------ 发件人: "mahmod2000";notifications@github.com; 发送时间: 2017年9月11日(星期一) 中午12:47 收件人: "troydavisson/PHRETS"PHRETS@noreply.github.com; 抄送: "浪子小风"1014825794@qq.com; "Mention"mention@noreply.github.com; 主题: Re: [troydavisson/PHRETS] Fatal error: Call to a member functionisError() on null (#165)
Hi @1014825794 Actually CRMLS returns the images in another resource called Media, rather than 'property'. So you need to get 'ListingKeyNumberic' and make a search in MLS data with 'Media' in resource and class parameters.
Regards,
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@1014825794 Maybe the relevant listing has just one image! send me what you made for searching images.
There shouldn't be only one. All you get is just one. I get it in CVS by getting what media has. Can you tell me how you did it? Here is the information I pulled to get the media:
$property_classes = array("Media"); foreach ($property_classes as $class) {
echo "+ Property:{$class}\n";
$file_name = strtolower("property_{$class}.csv");
$fh = fopen($file_name, "w+");
$maxrows = true;
$offset = 1;
$limit = 1000;
$fields_order = array();
while ($maxrows) {
$query = "(MediaType=Image),(TimestampModified=2000-01-01T00:00:00+),(ClassKey=8+)";
// run RETS search
echo " + Query: {$query} Limit: {$limit} Offset: {$offset}\n";
$search = $rets->SearchQuery("Media", $class, $query, array('Limit' => $limit, 'Offset' => $offset, 'Format' => 'COMPACT-DECODED', 'Count' => 1));
if ($rets->NumRows() > 0) {
if ($offset == 1) {
// print filename headers as first line
$fields_order = $rets->SearchGetFields($search);
fputcsv($fh, $fields_order);
}
// process results
while ($record = $rets->FetchRow($search)) {
$this_record = array();
foreach ($fields_order as $fo) {
$this_record[] = $record[$fo];
}
fputcsv($fh, $this_record);
}
$offset = ($offset + $rets->NumRows());
}
$maxrows = $rets->IsMaxrowsReached();
echo " + Total found: {$rets->TotalRecordsFound()}\n";
$rets->FreeResult($search);
}
fclose($fh);
echo " - done\n";
}
Thank you very much!!!
------------------ 原始邮件 ------------------ 发件人: "mahmod2000";notifications@github.com; 发送时间: 2017年9月13日(星期三) 凌晨1:14 收件人: "troydavisson/PHRETS"PHRETS@noreply.github.com; 抄送: "浪子小风"1014825794@qq.com; "Mention"mention@noreply.github.com; 主题: Re: [troydavisson/PHRETS] Fatal error: Call to a member functionisError() on null (#165)
@1014825794 Maybe the relevant listing has just one image! send me what you made for searching images.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@1014825794 Actually I just did search in Media class with this query: (ListingKeyNumberic=123456) And it returns all images.
Thank you very much for your help. I have been able to get the picture, but I have a new problem,I have access to relevant information listings, but in the acquisition of the contents inside, but not listing the longitude, and the broker and contact head, and so on, I would like to ask what is the reason I can't get these contents, how can I get the information, ask you to tell me what to do??? Thank you very much.
------------------ 原始邮件 ------------------ 发件人: "mahmod2000";notifications@github.com; 发送时间: 2017年9月18日(星期一) 晚上11:46 收件人: "troydavisson/PHRETS"PHRETS@noreply.github.com; 抄送: "浪子小风"1014825794@qq.com; "Mention"mention@noreply.github.com; 主题: Re: [troydavisson/PHRETS] Fatal error: Call to a member functionisError() on null (#165)
@1014825794 Actually I just did search in Media class with this query: (ListingKeyNumberic=123456) And it returns all images.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Hi,
I'm using PHRETS2, but sometimes I got the error below when I used GetObject to get images and I put this code "if(!$images->first()->isError())" after that. Error: "Fatal error: Call to a member function isError() on null"
Why this happened?
Regards,