php - How will i pass the value to the following format? -
i trying pass value function following url:
search?channelids=1,2,3&streamname=wew&page=0&size=10
code inside function:
$this->request->set("url","broadcasts/pubic/search"); $this->request->set_fields(array( 'channelids'=>$channel_ids, 'streamname'=>$stream_name, 'page'=>$page, 'size'=>$size )); $result = $this->request->send();
here pass values in format.how give pass value channelids=1,2,3? use http_build_query url formation. $channel_ids=array("channelids"=>1, "channelids"=>2, "channelids"=>3); $stream_name="wew"; $page=0; $size=10; $getlivebroadcast = $api-searchbroadcast($channel_ids,$stream_name,$page,$size);
how set value?
you can use urlencode function encode channel ids. function may like:
$this->request->set("url","broadcasts/pubic/search"); $this->request->set_fields(array( 'channelids'=>urlencode($channel_ids), 'streamname'=>$stream_name, 'page'=>$page, 'size'=>$size )); $result = $this->request->send();
Comments
Post a Comment