Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Anyone know any php? WTB Halp.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam
View previous topic :: View next topic  
Author Message
Aniblaze
Grandmaster Cheater Supreme
Reputation: 138

Joined: 23 Apr 2006
Posts: 1757
Location: The Netherlands

PostPosted: Fri Aug 21, 2015 5:07 pm    Post subject: Reply with quote

HackOtaku wrote:
oh, lol, I named $item as an array, then as the return object.
I changed it to $itemAr, but the issue is that

$itemAr[$j] = $item["name"];

when I attempt that, it tells me "name" is an illegal string offset, even though I can see the data in front of me.

It looks like the API you're talking to returns the data in JSON format. You'd need to use json_decode() first, and then use it as an object (e.g. $data->name).

EDIT: Also might I recommend installing and using xdebug on your dev machine? using print_r() or var_dump() is making it unnecessarily difficult for you to debug your code.
Back to top
View user's profile Send private message
HackOtaku
I posted the 500000th topic
Reputation: 81

Joined: 31 May 2007
Posts: 228

PostPosted: Fri Aug 21, 2015 6:21 pm    Post subject: Reply with quote

Aniblaze wrote:
HackOtaku wrote:
oh, lol, I named $item as an array, then as the return object.
I changed it to $itemAr, but the issue is that

$itemAr[$j] = $item["name"];

when I attempt that, it tells me "name" is an illegal string offset, even though I can see the data in front of me.

It looks like the API you're talking to returns the data in JSON format. You'd need to use json_decode() first, and then use it as an object (e.g. $data->name).

EDIT: Also might I recommend installing and using xdebug on your dev machine? using print_r() or var_dump() is making it unnecessarily difficult for you to debug your code.

ding ding. This solved everything and it all works now, thanks! And I will definitely be using xdebug in future php works.

Unfortunately, the person I am working with decided he doesn't much like php, and wants to do it all in javascript instead, lol.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Fri Aug 21, 2015 10:21 pm    Post subject: Reply with quote

If you move to nodejs you'll enjoy it. It is a very nice toolset to work with.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites