我正在使用zebra_curl / curl将网页缓存到缓存文件夹,然后我想访问看起来像标题信息的内容,因为它保存原始网址和处理缓存时我需要的其他信息文件。
起初我认为它是json,当使用json_decode我没有得到任何回报时,我已经在互联网上做了一些搜索,我可以找到很多关于转储到缓存文件但是没有关于读取缓存文件的信息。
下面是一个示例,为了这篇文章的目的,我已经删除了实际的html网页。
O:8:"stdClass":4:{s:4:"info";a:27:{s:12:"original_url";s:65:"http://www.amazon.co.uk/dp/B00OYTAQAM/ref=sr_1_1?m=A3P5ROKL5A1OLE";s:3:"url";s:65:"http://www.amazon.co.uk/dp/B00OYTAQAM/ref=sr_1_1?m=A3P5ROKL5A1OLE";s:12:"content_type";s:29:"text/html; charset=ISO-8859-1";s:9:"http_code";i:200;s:11:"header_size";i:1021;s:12:"request_size";i:191;s:8:"filetime";i:-1;s:17:"ssl_verify_result";i:0;s:14:"redirect_count";i:0;s:10:"total_time";d:1.0510690000000000310365066980011761188507080078125;s:15:"namelookup_time";d:2.300000000000000001799775606325937360452371649444103240966796875E-5;s:12:"connect_time";d:0.036834999999999999686917107055705855600535869598388671875;s:16:"pretransfer_time";d:0.036865000000000001934008508897022693417966365814208984375;s:11:"size_upload";d:0;s:13:"size_download";d:111412;s:14:"speed_download";d:105998;s:12:"speed_upload";d:0;s:23:"download_content_length";d:-1;s:21:"upload_content_length";d:0;s:18:"starttransfer_time";d:0.151627000000000011770140417866059578955173492431640625;s:13:"redirect_time";d:0;s:12:"redirect_url";s:0:"";s:10:"primary_ip";s:13:"178.236.6.251";s:8:"certinfo";a:0:{}s:12:"primary_port";i:80;s:8:"local_ip";s:13:"192.168.0.102";s:10:"local_port";i:54085;}s:7:"headers";a:2:{s:12:"last_request";a:1:{i:0;a:5:{s:14:"Request Method";s:55:"GET /dp/B00OYTAQAM/ref=sr_1_1?m=A3P5ROKL5A1OLE HTTP/1.1";s:10:"User-Agent";s:50:"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.2)";s:4:"Host";s:16:"www.amazon.co.uk";s:6:"Accept";s:3:"*/*";s:15:"Accept-Encoding";s:12:"gzip,deflate";}}s:9:"responses";a:1:{i:0;a:16:{s:6:"Status";s:15:"HTTP/1.1 200 OK";s:4:"Date";s:29:"Tue, 02 Jun 2015 19:02:52 GMT";s:6:"Server";s:6:"Server";s:6:"pragma";s:8:"no-cache";s:10:"x-amz-id-1";s:20:"1BSMQ0WW03GTYQ9G5KY3";s:3:"p3p";s:180:"policyref="http://www.amazon.co.uk/w3c/p3p.xml",CP="CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC "";s:8:"x-sap-pg";s:30:"video_games_display_on_website";s:13:"cache-control";s:8:"no-cache";s:15:"x-frame-options";s:10:"SAMEORIGIN";s:7:"expires";s:2:"-1";s:10:"x-amz-id-2";s:64:"tlcbwlgcLZUV2WrqsdudobEcS3jz5E5mMdCIRDXhNksTxmF1Y3StAaO+fmghPfux";s:4:"Vary";s:26:"Accept-Encoding,User-Agent";s:16:"Content-Encoding";s:4:"gzip";s:12:"Content-Type";s:29:"text/html; charset=ISO-8859-1";s:10:"Set-cookie";s:99:"session-id=279-5866789-0523540; path=/; domain=.amazon.co.uk; expires=Tue, 01-Jan-2036 00:00:01 GMT";s:17:"Transfer-Encoding";s:7:"chunked";}}}s:4:"body";s:475134:"
!!!HTML CODE HERE!!
";s:8:"response";a:2:{i:0;s:8:"CURLE_OK";i:1;i:0;}}
答案 0 :(得分:0)
在@Jon Stirling识别格式后使用unserialize()