It just wont give me a list

Hostteam

Verified User
Joined
Oct 18, 2008
Messages
7
Can someone, PLEASE tell me what i am doing wrong?

PHP:
$this->_socket = new HTTPSocket();
		$this->_socket->connect("<host>", 2222);
		$this->_socket->set_method("POST");
		$this->_socket->set_login("<user>", "<pass>");
		$this->_socket->query('/CMD_API_DATABASES',
			array(
				'domain' => 'christolmeijer.nl',
				'action' => 'users',
				'db' => 'aaaa_Test'
			)
		);
		$result = $this->_socket->result;
		echo serialize($result);
It echo's:
s:17:"HTTP/1.1 200 OK ";

I have this problem with more list request, its pretty annoying me...

EDIT:
Oh btw, this works if i paste it in my browser:
http://<host>:2222/CMD_API_DATABASES?action=users&db=aaaa_Test
 
Today i refreshed the page and it worked! I refreshed again and stopped working! Whats that! Im happy to know my code is working but why am i only receiving a list once?
 
Ok i debugged down trough whole the query function in the http socket class and found the problem and since i don't get any reactions i presume nobody knows the answer.

For some kind of reason, SOME of the list retreival methods dont work with POST so i had to set the method to get before i do the request.

so the answer: Set method to GET, when you retreive a list of course!

EDIT:
If you are just like me, to lazy to put set_method('get') everywhere, you can paste this code in the top of your query function in the httpsocket class,
which is wellknown here:
Code:
if(is_array($content)){
	        while($arr = current($content)){
	        	if(key($content)=="action" && $arr == "list"){
	        		$this->set_method('GET');
	        	}
				next($content);
			}
		}
(i beleive is_array is php 5 so if it doesnt work and you dont have php 5 remove that)
 
Last edited:
Back
Top