Questions tagged [httpful]

Httpful - A Chainable, REST Friendly, PHP HTTP Client. A sane alternative to cURL.

Httpful is a simple Http Client library for PHP 5.3+. There is an emphasis of readability, simplicity, and flexibility – basically provide the features and flexibility to get the job done and make those features really easy to use.


Features

  • Readable HTTP Method Support (GET, PUT, POST, DELETE, HEAD, PATCH & OPTIONS)
  • Custom Headers
  • Automatic "Smart" Parsing
  • Automatic Payload Serialization
  • Basic Auth
  • Client Side Certificate Auth
  • Request "Templates"

Documentation :

40 questions
6
votes
2 answers

Httpful post form data

I am using Httpful PHP library from http://phphttpclient.com/ , here is my sample code : $data = array( 'code' => $request->query->get('code'), 'client_id' => $this->container->getParameter('GOOGLE_CLIENT_ID'), …
Yusuf Ibrahim
  • 1,411
  • 2
  • 19
  • 39
5
votes
2 answers

HTTPful attach file and json-body in one request

I need to upload files via Rest and also send some configuration with it. Here is my example code: $this->login(); $files = array('file'=>'aTest1.jpg'); $data = array( 'name'=>'first file', 'description'=>'first file…
n00n
  • 626
  • 1
  • 7
  • 24
4
votes
3 answers

How to get an array instead of object when requesting JSON data using HTTPful

I'm using HTTPful to send some requests in PHP and get data in JSON, but the library is converting the result into objects, where I want the result to be an array. In other words, its doing a json_decode($data) rather than json_decode($data,…
Dreen
  • 6,128
  • 10
  • 44
  • 67
3
votes
1 answer

Httpful: Unable to parse response as JSON

I'm developing an web app using CodeIgniter and requesting data from a Slim REST Api. I'm having problems on my web app to get a response from a Httpful request. I use a base function to make all requests on my CodeIgniter frontend app, It goes like…
3
votes
1 answer

JSON JAX-RS in Java

I'm using Jersey for a RESTful web service in Java. I'm consuming them from a PHP client. I have it working fine with JSON as follows: PHP: (using httpful phar) $uri="http://localhost:8080/YYYYY/rest/common/json"; $r =…
Alejandro
  • 1,051
  • 3
  • 15
  • 29
2
votes
2 answers

Timeout not working in PHP Httpful request

I am having an http request and I am using "Httpful Request" to send it in PHP. I am setting a timeout of 20 seconds also in the request as follows: $req = Request::get($Url); $response = $req->timeoutIn(20)->expectsHtml()->send(); I was expecting…
Stanly
  • 547
  • 1
  • 5
  • 22
2
votes
1 answer

Httpful post with urlencode

I have a little laravel app and I added the http://phphttpclient.com/ - httpful REST Client to work with an external api - http://en.help.mailstore.com/spe/Management_API_-_Using_the_API I was able to "speak" with the mailstore api. Here is one…
user3382438
  • 131
  • 16
2
votes
1 answer

How to use Httpful PHP Library

I'm trying to learn REST, and thought it might be good to start with a PHP REST client such as Httpful. I just can't seem to get it to work. I downloaded the httpful.phar file and placed it in my working directory. Then created a simple php file…
Derek Morgan
  • 155
  • 1
  • 2
  • 15
2
votes
1 answer

Retrieving JSON response using HTTPful library for Laravel

I am currently building a e-mail client (inbound and outbound sending) using Mandrill as the e-mail sending / inbound service and Laravel 3.x. In order to send messages, I am using the HTTPful bundle with the Mandrill using the following code in my…
Matthew Gall
  • 131
  • 1
  • 7
1
vote
0 answers

Api multiple request httpful.phar Fatal error

I want to get 2 different sets of data using 2 different apis and display it on the same page. The first dataset displays fine however when doing the second request i get the error: Warning: Constant already defined in…
Fredde
  • 11
  • 2
1
vote
0 answers

What wrong with the query Error message {"errors":["undefined method `tempfile' for \"@/files/media/keywords.csv\":String"]}

I want to upload a file, I get the below error message {"errors":["undefined method tempfile'for\"@/files/media/keywords.csv\":String"]} Here is my code $ch = curl_init(); curl_setopt($ch,…
1
vote
1 answer

Httpful post & URL parameters

I am using Httpful PHP library from http://phphttpclient.com/ , here is my sample code : $uri = "https://ideabiz.lk/apicall/token?grant_type=password&username=user&password=pwd&scope=PRODUCTION"; $response= \Httpful\Request::post($uri) …
Thisaru
  • 171
  • 1
  • 10
1
vote
1 answer

Try/catch is ignored in Moodle/PHP when using httpful within a class

I have the following PHP script, test.php in my Moodle plugin: body($requestbody) ->send();…
Alex Black
  • 21
  • 4
1
vote
1 answer

Parse response from XML or JSON API with Httpful PHP

I am using the Httpful PHP library to GET data from an API using either JSON or XML. My code is very simple and returns the response from the url with basic authentication. $url = "API_URL"; $response = \Httpful\Request::get($url) ->expectsXml()…
Morgan
  • 504
  • 9
  • 25
1
vote
2 answers

PHP - How to get httpful phar to work

From http://phphttpclient.com I followed "Install option 1" and the first "quick snippet". I end up with the following, with Request undefined. Additionally, and perhaps relatedly, I am confused by the fact that one of the code samples says…
cja
  • 10,504
  • 18
  • 66
  • 120
1
2 3