For simplicities sake I have cut off most of this response string
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 06 Oct 2016 17:16:58 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
X-Rate-Limit-Limit: 300
X-Rate-Limit-Remaining: 297
X-Rate-Limit-Reset: 24
Strict-Transport-Security: max-age=86400 { "status" : 200, "requestId" : "0290bc44-ee91-44b5-8a4e-d2abde77dda2", "likelihood" : 0.89, "photos" : [ { "type" : "facebook", "typeId" : "facebook", "typeName" : "Facebook", "url" : "https://d2ojpxxtu63wzl.cloudfront.net/static/354316d570e9a875994ebace97f5c499_aadb87c0d5bfdca27ec6d9de1467b45856e2d1e9d5aba04a50cfaa76c0887dd9", "isPrimary" : true }, { "type" : "linkedin", "typeId" : "linkedin", "typeName" : "LinkedIn", "url" : "https://d2ojpxxtu63wzl.cloudfront.net/static/fbb7ab1a477ac0721fa1b6343e65cda8_69b2ec8691007604f741862a51146ab259c689db392a21ab3df697248df68d17" }, { "type" : "google", "typeId" : "google", "typeName" : "GooglePlus", "url" : "https://d2ojpxxtu63wzl.cloudfront.net/static/f08e1cdd3673736fe94a131eb02d5cf2_1d48402d2de6af8479415653cb1f2eb52a715650862e50a6bcac0a6477e32a07" }, { "type" : "gravatar", "typeId" : "gravatar", "typeName" : "Gravatar", "url" : "https://d2ojpxxtu63wzl.cloudfront.net/static/da16a86493fdb3ab77238be7ac5161e6_33ad1223f2c4813fe954eb33cf2f9f3b2cd597b7331be6b53646dd9dd0e68152" },
I am grabbing the http headers that I need in this request using php. After words I will need to grab everything minus the http headers to return and be used. I have tried using substr()
to cut and use everything after a certain amount of characters (the end of the headers) but has proven untrustworthy as it cuts it off after an exact amount of characters and the HTTP request is subject to change at any time. I expect that regular expressions will be key to this but I would appreciate any helpful ways to go about this. I will be needing to cut the string off right after max-age=86400. Everything after that is the JSON that will need parsed