You are hereHttp POST using HttpFul PHP REST library
Http POST using HttpFul PHP REST library
Spent considerable amount of time to find a working solution to do http post with httpful php library, even though spent some time to find a solution from internet & httpful documentation, unfortunately couldn't find exact http post usage with httpful.
The problem faced was that whenever http post is tried, instead of going as post parameters, the parameters were sent as part of http request body.
The solution was to use code "->body($arr, Httpful\Mime::FORM)" rather than the logical "->body($arr)"
Sharing following working code to make things easier for php community. In case if have trouble to debug, you may use excellent online http request debug service from requestb.in website
public function SendMessage()
{
$url='http://sampleUrl.com/postTest.php'; //post url here
$arr=array('user-name'=>'name','password'=>'pass','message'=>'msg'); //post params here
$resp = \Httpful\Request::post($url) // Build a Post request...
->body($arr, Httpful\Mime::FORM) // Httpful\Mime::FORM => causes to do http post
->expectsJson()
->send();
//return json_encode($resp->body); //if ->expectsJson() line not there
return ($resp->body);
}