Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Oct 2008
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Searching a string to reset variable

    I have a task where ill be parsing code from a pre-existing template into a variable...and then i need to isolate part of that and return it as the value of the variable to be submitted elsewhere.

    Basically the string im looking at contains ","Id":16132379," where only the number is what im after as returning. What I've attempted comes down to:

    Where "Id" is found return string following between ':' and ','. I really don't know much more on how to do this, I'm experienced in html and javascript but still learning php at a rapid pace - dont have much long-term experience to actively process code in my head(that i dont know.)

    This is the only roadblock in my current project and any insight GREATLY appreciated!

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    Quote Originally Posted by ceylon View Post
    I have a task where ill be parsing code from a pre-existing template into a variable...and then i need to isolate part of that and return it as the value of the variable to be submitted elsewhere.

    Basically the string im looking at contains ","Id":16132379," where only the number is what im after as returning. What I've attempted comes down to:

    Where "Id" is found return string following between ':' and ','. I really don't know much more on how to do this, I'm experienced in html and javascript but still learning php at a rapid pace - dont have much long-term experience to actively process code in my head(that i dont know.)

    This is the only roadblock in my current project and any insight GREATLY appreciated!
    PHP Code:
    str_replace(","""$str);
    explode(":"$Str); 

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by ceylon View Post
    I have a task where ill be parsing code from a pre-existing template into a variable...and then i need to isolate part of that and return it as the value of the variable to be submitted elsewhere.

    Basically the string im looking at contains ","Id":16132379," where only the number is what im after as returning. What I've attempted comes down to:

    Where "Id" is found return string following between ':' and ','. I really don't know much more on how to do this, I'm experienced in html and javascript but still learning php at a rapid pace - dont have much long-term experience to actively process code in my head(that i dont know.)

    This is the only roadblock in my current project and any insight GREATLY appreciated!
    try this:
    PHP Code:
    $result preg_replace("/Id:(\d+),/","$1",$yourstring); 
    best regards

  • #4
    New Coder
    Join Date
    Oct 2008
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question

    The variable I'll be working from will contain the following as an example, with varying data per each instance but always the same structure. Right now I'm only concerned with pulling is line 22, "Id":16132379,... but if it would be easier to parse this all to an array i'm open for all suggestions. This is typically all in a string with no returns or breaks, I formatted this way to be more readable.

    {
    "adr":"11501 111Th Pl Ne",
    "bt":"\u0000",
    "ct":"Kirkland",
    "ds":"Seattle",
    "lid":"1107314912",
    "lt":"\u0000",
    "mls":"29028784",
    "ph":"",
    "phl":null,
    "pl":null,
    "sn":"11501 111Th Pl NE, Kirkland, WA 98033 (MLS ID: 29028784)",
    "sq":0,
    "svid":0,
    "advid":"381950",

    "agt":{
    "AdId":381950,
    "AgBcc":"dianewilcox@remax.net",
    "Disp":2,
    "Em":"dianewilcox@remax.net",
    "Id":16132379,
    "Nm":"Diane M. Wilcox",
    "OfBcc":""},

    "bds":4,
    "bts":3.00,
    "byagt":null,
    "byoff":null,
    "csp":"Kirkland, WA 98033",
    "exp":false,
    "lat":"47.703696",
    "lng":"-122.192405",
    "nrt":false,

    "off":{
    "AdId":-1,
    "Bcc":"",
    "Disp":1,
    "Em":"",
    "Id":21545547,
    "Nm":"RE\/MAX REALTY EXPERTS"},

    "photos":[
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0o.jpg",
    "seq":0,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1o.jpg",
    "seq":1,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2o.jpg",
    "seq":2,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3o.jpg",
    "seq":3,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4o.jpg",
    "seq":4,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5o.jpg",
    "seq":5,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6o.jpg",
    "seq":6,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7o.jpg",
    "seq":7,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8o.jpg",
    "seq":8,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9o.jpg",
    "seq":9,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10o.jpg",
    "seq":10,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11o.jpg",
    "seq":11,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12o.jpg",
    "seq":12,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13o.jpg",
    "seq":13,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14o.jpg",
    "seq":14,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14x.jpg"}],

    "pr":829000,
    "product":"4224",
    "seo":"http:\/\/www.realtor.com\/realestateandhomes-detail\/11501-111Th-Pl-Ne_Kirkland_WA_98033_1107314912",
    "shc":true,
    "sld":false,
    "st":"WA",
    "type":"X",
    "vh":300,
    "vurl":"",
    "vw":332,
    "zp":"98033"}

  • #5
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by ceylon View Post
    The variable I'll be working from will contain the following as an example, with varying data per each instance but always the same structure. Right now I'm only concerned with pulling is line 22, "Id":16132379,... but if it would be easier to parse this all to an array i'm open for all suggestions. This is typically all in a string with no returns or breaks, I formatted this way to be more readable.

    Code:
    {
    "adr":"11501 111Th Pl Ne",
    "bt":"\u0000",
    "ct":"Kirkland",
    "ds":"Seattle",
    "lid":"1107314912",
    "lt":"\u0000",
    "mls":"29028784",
    "ph":"",
    "phl":null,
    "pl":null,
    "sn":"11501 111Th Pl NE, Kirkland, WA 98033 (MLS ID: 29028784)",
    "sq":0,
    "svid":0,
    "advid":"381950",
    
    "agt":{
    "AdId":381950,
    "AgBcc":"dianewilcox@remax.net",
    "Disp":2,
    "Em":"dianewilcox@remax.net",
    "Id":16132379,
    "Nm":"Diane M. Wilcox",
    "OfBcc":""},
    
    "bds":4,
    "bts":3.00,
    "byagt":null,
    "byoff":null,
    "csp":"Kirkland, WA 98033",
    "exp":false,
    "lat":"47.703696",
    "lng":"-122.192405",
    "nrt":false,
    
    "off":{
    "AdId":-1,
    "Bcc":"",
    "Disp":1,
    "Em":"",
    "Id":21545547,
    "Nm":"RE\/MAX REALTY EXPERTS"},
    
    "photos":[
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0o.jpg",
    "seq":0,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m0x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1o.jpg",
    "seq":1,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m1x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2o.jpg",
    "seq":2,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m2x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3o.jpg",
    "seq":3,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m3x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4o.jpg",
    "seq":4,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m4x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5o.jpg",
    "seq":5,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m5x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6o.jpg",
    "seq":6,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m6x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7o.jpg",
    "seq":7,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m7x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8o.jpg",
    "seq":8,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m8x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9o.jpg",
    "seq":9,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m9x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10o.jpg",
    "seq":10,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m10x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11o.jpg",
    "seq":11,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m11x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12o.jpg",
    "seq":12,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m12x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13o.jpg",
    "seq":13,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m13x.jpg"},
    {"caption":"",
    "lgURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14l.jpg",
    "mdURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14m.jpg",
    "orURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14o.jpg",
    "seq":14,
    "smURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14s.jpg",
    "tnURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14t.jpg",
    "xlURL":"http:\/\/p.rdcpix.com\/v01\/le0480042-m14x.jpg"}],
    
    "pr":829000,
    "product":"4224",
    "seo":"http:\/\/www.realtor.com\/realestateandhomes-detail\/11501-111Th-Pl-Ne_Kirkland_WA_98033_1107314912",
    "shc":true,
    "sld":false,
    "st":"WA",
    "type":"X",
    "vh":300,
    "vurl":"",
    "vw":332,
    "zp":"98033"}
    use code tags, please. It's just a intuition and maybe I'm wrong but this is not json? If answer is yes why you don't use a json parser?

    http://www.json.org/
    see also the php section from the bottom of the page and:

    http://gggeek.altervista.org/sw/article_20061113.html

    or php manual:
    http://www.php.net/manual/en/book.json.php

    best regards

  • #6
    New Coder
    Join Date
    Oct 2008
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts
    ! great!

    Code:
    $ret = json_decode($ret, true);
    adds to an array in one step, hard to believe it was that easy.. I recognized this as obviously being pre-formatted for some sort of parsing, but I wasn't familiar with JSON at all. Thanks for catching that!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •