I am trying to pull some data from a report that is simple called an API link. I am not familiar with the data format. Hopefully, I can find out the format and see if someone has already developed some PHP code to access and manipulate this. I thought it would be better to ask the commmunity before I just start screen scraping it as there is probably a better way.


Thank you for any information you can provide. Below is abbreviated code that shows the structure. There is no header or footer to identify the type of code like I see in XML.

{
    "totalCount": "35",
    "columns": [
        {
            "index":"0",
            "dataType":"text",
            "label": "Grouping Name"
        },
        {
            "index":"1",
            "dataType":"text",
            "label": "Location Abbreviation"
        },
            "index":"5",
            "dataType":"number",
            "label": "Total Area"
        },
            "dataType":"currency",
            "label": "Charge Amount"
        },
            "index":"11",
            "dataType":"date",
            "label": "Start Date"
        },
        {
            "index":"20",
            "dataType":"currency",
            "label": "$Cost"
        },
    ],
    "records": [
        {
                "0":"<a name=\"<portfolio name>\" href=\"/server/properties/portfolio_summary.do?entityID=12344\"\><portfolio name></a\>",
                "1":"BCD234",
                "5":"1140.0",
                "7":"$1,295.00",
                "8":"$1,500.00",
                "10":"<a name=\"Lincoln, A.\" href=\"/server/code.do?entityID=12345\"\>Lincoln, A.</a\>",
                "11":"01/26/2012",
                "13":"345 Any St.",
                "28":"$1,295.00"
        },
        {
                "0":"<a name=\"<portfolio name>\" href=\"/server/properties/portfolio_summary.do?entityID=12344\"\><portfolio name></a\>",
                "1":"ABC123",
                "5":"1226.0",
                "7":"$0.00",
                "8":"$1,300.00",
                "10":"<a name=\"Lincoln, A.\" href=\"/server/code.do?entityID=12345\"\>Lincoln, A.</a\>",
                "11":"12/20/2011",
                "13":"123 Any Ave"
                },
     
}

Recommended Answers

All 2 Replies

This is JSON, use print_r(json_decode($data,true)); to display the array, bye.

commented: quick and accurate +1

This is JSON, use print_r(json_decode($data,true)); to display the array, bye.

cereal,
Thank you for the quick reply and the pointer to json_decode. Exactly what I needed to get some test code in place.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.