Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-11-2013, 08:26 AM   PM User | #1
fail
Regular Coder

 
Join Date: Dec 2009
Location: Hong Kong
Posts: 118
Thanks: 8
Thanked 0 Times in 0 Posts
fail is an unknown quantity at this point
Is this an object? How to covert it?

I am working the myWOT API response code. What I get from their server seems to be an Object, rather then an Array.

What I want to get is: 83 - 86 - 88 - 86

How can I get there?

PHP Code:
string(106"{ "foxnews.com": 

                        { "
target": "foxnews.com", 
                        
                        "
0": [ 83, 57 ], 
                        "
1": [ 86, 61 ], 
                        "
2": [ 88, 65 ], 
                        "
4": [ 86, 62 ] 
                        
                        } 
            }" 
Update: I didn't solve object issue at all, but found out the myWOT also has a XML output which makes things much easier.

Last edited by fail; 02-11-2013 at 10:38 AM..
fail is offline   Reply With Quote
Old 02-11-2013, 01:30 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
XML is a lot easier to work with, so stick with that.
That is neither an object nor an array. That is a string. You can decode that using json_decode() function which will return an object.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 02-12-2013, 06:25 AM   PM User | #3
Dormilich
Senior Coder

 
Dormilich's Avatar
 
Join Date: Jan 2010
Location: Behind the Wall
Posts: 2,855
Thanks: 9
Thanked 288 Times in 284 Posts
Dormilich is on a distinguished road
Quote:
Originally Posted by Fou-Lu View Post
You can decode that using json_decode() function which will return an object.
or an array, if you tell json_decode() to generate one instead of an object.
__________________
please post your code wrapped in [CODE] [/CODE] tags
Dormilich is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:59 AM.


Advertisement
Log in to turn off these ads.