Curl error during POST
panthar opened this issue · 6 comments
When trying the example cron script, I get the following backtrace:
Fatal error: Uncaught exception 'Exception' with message 'Error during POST of 'https://secure.me.com/device_mgmt/en': Failed to open/read local data from file/application' in /home/user/dev/sosumi/class.sosumi.php:221
Stack trace:
0 /home/user/dev/sosumi/class.sosumi.php(148): Sosumi->curlPost('https://secure....', NULL, 'https://secure....', Array)
1 /home/user/dev/sosumi/class.sosumi.php(51): Sosumi->getDevices()
2 /home/user/dev/sosumi/foo.php(16): Sosumi->__construct('myuser', 'mypass')
3 {main}
thrown in /home/user/dev/sosumi/class.sosumi.php on line 221
PHP = 5.2.4
libcurl3 = 7.18.0
Updated to curl 7.18.2 and PHP 5.2.6, same error.
I'm unable to reproduce this running the same version of curl and PHP 5.3.0. Any other data you can give me to help debug?
When I turn on verbose for curl, here's what I get (with a few cookie values obscured):
-
About to connect() to secure.me.com port 443 (#0)
-
Trying 17.250.248.137... * connected
-
Connected to secure.me.com (17.250.248.137) port 443 (#0)
-
successfully set certificate verify locations:
-
CAfile: none
CApath: /etc/ssl/certs -
SSL connection using RC4-MD5
-
Server certificate:
-
subject: /1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=California/2.5.4.15=V1.0, Clause 5.(b)/serialNumber=C0806592/C=US/postalCode=95014/ST=California/L=Cupertino/streetAddress=1 Infinite Loop/O=Apple Inc./OU=Internet Services/CN=secure.me.com
-
start date: 2009-06-30 00:00:00 GMT
-
expire date: 2011-03-22 23:59:59 GMT
-
common name: secure.me.com (matched)
-
issuer: /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)06/CN=VeriSign Class 3 Extended Validation SSL SGC CA
-
SSL certificate verify ok.
POST /device_mgmt/en HTTP/1.1
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9
Host: secure.me.com
Referer: https://secure.me.com/account/
Cookie: NSC_bddpvou.xpb-wjq=445ea1281062; aic=xxxxxxxxxxxxg==; isc-secure.me.com=xxxxxxxxxxxxxxx; al-acl=y; mmi=lang=en:tz=222:calstatus=0:webmailclientpref=3.0; mmr=n10; mma-account=
Accept: text/javascript, text/html, application/xml, text/xml, /
X-Requested-With: XMLHttpRequest
X-Prototype-Version: 1.6.0.3
X-Mobileme-Version: 1.0
X-Mobileme-Isc: xxxxxxxxxxx
Content-Length: 0
Content-Type: application/x-www-form-urlencoded -
Closing connection #0
-
Failed to open/read local data from file/application
Fatal error: Uncaught exception 'Exception' with message 'Error during POST of 'https://secure.me.com/device_mgmt/en': Failed to open/read local data from file/application' in /home/panthar/dev/sosumi/class.sosumi.php:221
If it's hard to read here, I can put any debug info you need into pastebin
Looks like the github markup had some fun with it - here it is in pastebin:
http://panthar.pastebin.com/m7849b94a
I found it! Inside class.sosumi.php:
Line 148:
$html = $this->curlPost('https://secure.me.com/device_mgmt/en', null, 'https://secure.me.com/account/', $headers);
I changed the null to an empty string (''), and did the same to line 155.
I did some reading on similar curl errors and found that (this may have been updated in your PHP 5.3) it needs to pass something to POST, even an empty string. A null was killing it.
Aha. Thanks. I've pushed a new release that should fix the problem.