从数据库中读取Blob - 使用cUrl - > Rest API

时间:2013-10-15 15:14:52

标签: php json rest curl blob


我想我已经达到了死胡同......我正在尝试使用cUrl(在php中)从数据库中检索Blob。流程如下所示 PHP(cUrL) - > 'url request' - > Rest API - >数据库 - >休息 - > PHP中的数组。

我已经看到了很多例子如何使用直接SQL查询来完成它,但在我正在做的事情并非如此。下面你可以看到有问题的对象的json数据表示。

"id": "f8fd460f-49a3-4f8b-91f9-5de8200b79e3",
    "insertedOn": "2012-12-01T18:57:17Z",
    "updatedOn": "2012-12-01T18:57:17Z",
    "identifier": "VirtuconAdapter@3238808399@2012-12-01T18:57:17.648+0000",
    "messageId": "0000c62a-f5bc-4900-8b46-7de4164abf09",
    "payloadSizeBytes": 0,
    "payload": "Cgo8P3htbCB2ZXJzaW9uPSIxLjAiPgo8RG9jdW1lbnQ+CiAgPExpbmU+VGhlIFNreW5ldCBGdW5kaW5nIEJpbGwgaXMgcGFzc2VkLjwvTGluZT4KICA8TGluZT5UaGUgc3lzdGVtIGdvZXMgb24tbGluZSBBdWd1c3QgNHRoLCAxOTk3LjwvTGluZT4KICA8TGluZT5IdW1hbiBkZWNpc2lvbnMgYXJlIHJlbW92ZWQgZnJvbSBzdHJhdGVnaWMgZGVmZW5zZS48L0xpbmU+CiAgPExpbmU+U2t5bmV0IGJlZ2lucyB0byBsZWFybiBhdCBhIGdlb21ldHJpYyByYXRlLjwvTGluZT4KICA8TGluZT5JdCBiZWNvbWVzIHNlbGYtYXdhcmUgYXQgMjoxNCBhLm0uIEVhc3Rlcm4gdGltZSwgQXVndXN0IDI5dGguPC9MaW5lPgogIDxMaW5lPkluIGEgcGFuaWMsIHRoZXkgdHJ5IHRvIHB1bGwgdGhlIHBsdWcuPC9MaW5lPgo8L0RvY3VtZW50PgoK",
    "metadata": {
        "source": "CyberdyneEngineering",
        "adapter_id": "VirtuconAdapter",
        "messageType": "T1000",
        "payloadIdentifier": "VirtuconAdapter@3238808399@2012-12-01T18:57:17.648+0000",
        "timestamp": "@2012-12-01T18:57:17.648+0000",
        "transactionRef": "REF1985300039",
        "hubItinerary": "CyberdyneAdapter",
        "destination": "VirtuconEngineering",
        "messageuniqueid": "0000c62a-f5bc-4900-8b46-7de4164abf09",
        "randomString": "@3238808399",
        "adpnextmlemarkersequence": "24",
        "documentTrackingId": "D0198556465",
        "routingDestination": "client.VirtuconAdapter.receive"
    }

所以现在关键是将整个元数据数组(blob)整合到php中。希望我能很好地解释这个问题。

感谢您寻求帮助

1 个答案:

答案 0 :(得分:1)

如果我正确理解你,你已经将整个json对象存储在SQL中作为blob,并且你刚刚使用PHP将它从数据库中删除。

此时,你将拥有一串json。是什么阻止你对该字符串执行json_decode方法?