HttpRequest error

General discussion on PHP
Post Reply
vlad3046
Posts: 1
Joined: Sat Jan 02, 2016 9:08 am

HttpRequest error

Post by vlad3046 » Sat Jan 02, 2016 9:15 am

Good day! I have installed trial Zend Studio and can't perform HttpRequest using standart tools. I write this:

Code: Select all

$r = new HttpRequest('*ttp: / / ****** / method / users.get?user_ids=' + $x + '&fields=sex,bdate,city,country,domain,has_mobile,contacts,connections,site,education,universities,schools,can_post,can_see_all_posts,can_see_audio,can_write_private_message,status,last_seen', HttpRequest::METH_GET);
	$response = $r->send();
	echo "<pre>";
	var_dump($response->getHeaders());
	echo $response->getResponseCode();
	echo $response->getResponseStatus();
	echo "</pre>";
And result is:
array(0) {
}
404Not Found

This request performs in browser , is there posibility that my problem in my Zend settings ? If so, what I can do?

User avatar
kaloyan_r
Zend Product Manager
Posts: 582
Joined: Thu May 23, 2013 12:40 pm

Re: HttpRequest error

Post by kaloyan_r » Mon Jan 04, 2016 11:38 am

Moving to the PHP Programming forum as this seems to be a generic PHP question.

My guess is that you are doing the string concatenation incorrectly in the HttpRequest constructor. In PHP there is a special operator (.) for string concatenation that should be used instead of the arithmetic operator for addition (+).

Check this section in the PHP Manual: http://php.net/manual/en/language.operators.string.php
Kaloyan Raev
Zend Studio Team

Post Reply