-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stopped working #6
Comments
Using osx and php version 5.6.27 In using a big set of code but even using your simple code from read me to print devices provides the error. This did work last week. |
We will still need to see the error message to help you. @kristianolofsson Can you create a file called "test.php" with the simple contents below (replace with your icloud username and password), then copy and paste the output
|
Hi I use this part of the q code changed as follows If (isset ($ headers ['X-Apple-MMe-Host'])) { Follow the link to my complete code http://pastebin.com/FhHQKJF0 |
Sorry, thank you !!! |
Hmm, cannot seem to get it working with the proposed changes. The simple printDevices with debug=TRUE actually prints everything (without debug=TRUE just gives the errors) but with these errors:
246: $arrHeaders["Content-Length"] = strlen($request); there should not be any modifications other than those on the pull request. Funny thing is that in Domoticz the presence detection script is working fine with: I noticed the headers are a bit different but that should not matter as these here work for you? Any ideas what could be wrong? edit: without debug and php error_reporting = 0 it gives:
|
typo in your header looks like you've replaced the header manually, with a typo in some places and not others. The code can be tidied up somewhat now there is no need to insert a custom endpoint url each call/ The URL is static. This would prevent such errors. |
Guess this means I'm pretty tired (that is what I suspected but just couldn't see it)... 😄 Thanks! |
@beinnlora Warning: sprintf(): Too few arguments in FindMyiPhone.php on line 129
|
@Halyspectro this is not an issue with the library, but a general PHP coding issue. I don't think this is the best place to support you in fixing your code, but I will try. You need to understand the error message and interpret its use in your code. You have three %s inside the quotes, and just two variables/arguments outside the quotes: hence the error message saying 'too few arguments' The old Apple iCloud service was accessed from a URL like The new Apple iCloud service URL looks like this: You can see it doesn't need MMe_Host and MMe_scope any longer, but does need your Apple username. You therefore need to change any CURLOPT_URL in your code to create a URL in the new format. For flexibility in case the url changes again, we can define the HOST in a variable (the "fmipmobile.icloud.com" bit of the address) - also to save us typing it out each time and making mistakes. The whole URL for triggering an event, e.g. "playSound" is something like: Therefore in your code we need to make THREE substitutions in your url - to insert the HOST, USERNAME and METHOD in the right places. so each CURLOPT_URL should look a little like this: each %s inside the quotation marks is replaced in turn with the three variables you define outside the quotation marks. Any further questions I would ask you to please raise on a general PHP discussion forum, as it is not really an issue with the library. Try stackexchange.com good luck |
Thanks a lot! Working fine.
I did find though that the "listdevices" function was removed. I kinda used that so please add it back.
Kristian Olofsson
0736-336291
On 13 Jan 2017, at 20:23, beinnlora <[email protected]> wrote:
@Halyspectro this is not an issue with the library, but a general PHP coding issue. I don't think this is the best place to support you in fixing your code, but I will try.
You need to understand the error message and interpret its use in your code.
Here, the "%s" inside the quotes will be substituted with the values of the variables ('Arguments') outside the quotes.
See this explanation:
http://www.w3schools.com/php/func_string_sprintf.asp
You have three %s inside the quotes,
https: //% s / fmipservice / device /% s /% s
and just two variables/arguments outside the quotes:
$ this-> host and $ method
hence the error message saying 'too few arguments'
Previously the FindMyiPhone class required the values X-Apple-MME-host and X-Apple-MME-Scope to create the correct URL to call.
The recent change to the Apple service means you no longer need to supply these two X-Apple-MME variables each time you call the Apple API url. You therefore need to change any CURLOPT_URL in your code, to a new URL that doesn't include the MMe-Host and MMe-Scope, and instead includes your iCloud username.
For flexibility in case the url changes again, we can also define the HOST in a variable (the "fmipmobile.icloud.com" bit of the address) - also to save us typing it out each time and making mistakes.
The whole URL for triggering an event, e.g. "playSound" is something like:
"https://fmipmobile.icloud.com/fmipservice/device/[email protected]/playSound"
which you would make up from your variables:
http:// $this->host /fmipservice/device/ $username $method
Therefore in your code we need to make THREE substitutions in your url - to insert the HOST, USERNAME and METHOD in the right places.
so each CURLOPT_URL should look a little like this:
CURLOPT_URL => sprintf ("https: //%s/fmipservice/device/%s/%s", $this->host, $username, $method),
each %s is replaced in turn with the three variables you define outside the quotation marks.
Any further questions I would ask you to plase raise on a general PHP discussion forum, as it is not really an issue with the library. Try stackexchange.com
good luck
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@kristianolofsson public function printDevices() still exists... No functions have been removed from the library in the latest commit (Jan 2016)... unless some element of the API has changed that we have no control over.. |
@beinnlora @albeebe
And I took this value this way and then I saw that it was a real apple id. |
Trying to use the find my iPhone class but gets error about multiple slashes. What's wrong?
The text was updated successfully, but these errors were encountered: