2

The documentation explains to crate objects using the site's url minus the TLD which appears to work fine.

$service = new Post_Exchange('gamedev', null, 0);

returns what appears to be a valid object (via var_dump):

object(Post_Exchange)#1 (9) 
{ 
   ["cache_path"]=> string(6) "cache/" 
   ["_site":"Stack_Base":private]=> string(7) "gamedev" 
   ["_key":"Stack_Base":private]=> NULL 
   ["api_version":protected]=> string(3) "1.0" 
   ["_cache":"Stack_Base":private]=> bool(false) 
   ["_cache_ttl":"Stack_Base":private]=> int(0) 
   ["_current":"Stack_Base":private]=> NULL 
   ["_max":"Stack_Base":private]=> NULL 
   ["last_request":protected]=> NULL 
}

but trying to execute a search fails.

  $results = $service->question(
     implode(';', $qid), array(
     'answers' => 'true', 
     'body' => 'true', 
     'sort' => 'votes',));

Dumping $results gives NULL.

I constantly get the same behavior from sites like CSTheory and Programmers but consistently get expected behavior from Stack Overflow and Server Fault.

Am I missing something obvious or is there a bug?

I'm using version 0.3 downloaded from pear.

1 Answer 1

1

I am the author of stack.PHP and I'd be glad to answer your question.

The problem is that those sites are actually sub-domains of 'stackexchange.com', so what you need to do is change:

$service = new Post_Exchange('gamedev', null, 0);

to:

$service = new Post_Exchange('gamedev.stackexchange', null, 0);

Hopefully you get the expected results. If not please let me know.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.