Questions tagged [http-request2]

The HTTP_Request2 package is a rewrite of HTTP_Request in PHP5 and makes it easier for PHP applications to perform HTTP requests.

As per the documentation:

HTTP_Request2 package provides an easy way for PHP applications to perform HTTP requests. It supports a large subset of Hypertext Transfer Protocol features, and can be used for the following:

  • Working with web services (numerous PEAR packages in Web Services category are using HTTP_Request2 under the hood);
  • Checking the validity of web links;
  • Grabbing and parsing remote web pages;
  • Automated form submission.

This was introduced with the PHP5 rewrite of the HTTP_Request module. The latest stable release is 2.3.0, released on 2016-02-13. It can be easily installed using the following command:

pear install HTTP_Request2
22 questions
3
votes
1 answer

HTTP_Request2 POST parameters ignored?

A query with curl, like this, works fine: curl -XPOST -H "Content-Type: application/json" -d '{"query":"porges","start":0,"rows":10,"lang":"ENGLISH"}' http://localhost:8080/services/rest/index/z56508/search/field/search I my case I get 11 hits…
Leo
  • 4,136
  • 6
  • 48
  • 72
2
votes
2 answers

Extract data from HTTP_Request2_Response object using PHP

I am currently working on the response from the Microsoft Emotion API. In the API, HTTP/Request2.php is used and I successfully get the HTTP response message by using getBody() in HTTP_Request2_Response(Manual here). Just like the API manual, I do…
Michael Y.
  • 23
  • 5
1
vote
0 answers

PHP Fatal error: Uncaught Error: Class 'http\\Client' not found http_request2

I am trying to set up a safety pasarela using http_request2 (https://documenter.getpostman.com/view/10111708/TVmLCykr) Use composer $ /usr/local/bin/composer info guzzlehttp/guzzle 7.2.0 Guzzle is a PHP HTTP client library guzzlehttp/promises 1.4.0…
1
vote
0 answers

PHP : HTTP_request2: saving a file from reponse body from a post request

I need help making this to work. My request works fine in postman, i get access to my file (zip file in this example) by clicking the button save response as: in postman. In php, i am trying to access the same file but cant find how. Headers are…
MarcG73
  • 11
  • 2
1
vote
0 answers

How to avoid "Peer certificate CN=`...' did not match expected CN"

I switched from PHP 5.4 to 5.6 on my production system (running on a shared hosting provider). My queries of a particular website are now getting the error "stream_socket_client(): Peer certificate CN='(redacted).com' did not match expected…
Bob
  • 150
  • 1
  • 8
1
vote
0 answers

HTTPS Requests error with HTTP_Request2 in PHP 5.4.12

I don't have any issues with using PEAR's HttpRequest2 for HTTP Requests, however this issue starts when I have an API in an HTTPS url; Do note that I'm using PHP 5.4.
Patrick Younes
  • 139
  • 1
  • 15
1
vote
1 answer

HTTP_Request2 GET error

I am trying to connect to my Amazon EC2 website from my PHP server hosted on Godaddy. So using HTTP_Request2, I use the following: $request = new HTTP_Request2('http://XX.XX.XXX.XXX:3007/something/something', HTTP_Request2::METHOD_GET); This…
user4553140
1
vote
0 answers

Login to hotmail using http requests

I am trying to simulate login to hotmail.com using proper HTTP requests and cookies. I am using PEAR HTTP_Request2 package for handling these http requests. I have successfully rendered the Login Page >>…
1
vote
2 answers

HTTP request 301 and 302 error

I am using the http_request()(http://pear.php.net/package/HTTP_Request2/) to check the page status. Its working fine but in the time of checking the external links it returns 301 and 302 error.but those links are loading perfectly in browser. For…
1
vote
1 answer

PHP - getCookies() empty but getHeaders() not

I am trying to parse the response header cookies for a GET request. For some reason, getCookies() is empty! I get a 200 Response but for some reason cannot access the cookies. I'm able to get the headers, though. Is it possible this website is…
Mark Kennedy
  • 1,751
  • 6
  • 30
  • 53
0
votes
0 answers

Differents between CURL and Guzzle,Pecl-http and Http-request2

What are Differents between CURL and Guzzle,Pecl-http and Http-request2 ? I want to connect to one site with api,I always use curl and it works for me.can I use Guzzle or Pecl-http or Http-request2 instead of curl in codeigniter or php?
marka
  • 1
  • 1
  • 1
0
votes
2 answers

docker php:7.1-apache don't load http_request2

as first thing a wish to tell that I'm a noob with docker. I'm trying to use docker to have a virtualized Apache on my machine. This is my dockerfile FROM php:7.1-apache RUN docker-php-ext-install mysqli RUN pecl install xdebug-2.6.0 RUN echo…
Stefano G.
  • 143
  • 2
  • 14
0
votes
0 answers

How to decode protected response from HTTP_Request2 in PHP

I am trying to post a SOAP Request to an Oracle Database using PHP with the HTTP_Request2 package. It is looking like I am getting a response, but it is not the response I am expecting. The code I have for making the request is below: $request = new…
0
votes
2 answers

failed to open stream. no such file or directory Request2.php

I am using Ubuntu 19.10 and have installed pear/Request2 using sudo pear install http_request2. I am trying to use it inside my PHP file while sending a request to Azure Face API but it is giving me the following error. Warning:…
Jamshaid
  • 370
  • 2
  • 11
  • 40
0
votes
1 answer

PEAR module (HTTP_Request2) installed, but not recognized in php file?

I have HTTP_Request2 installed on my server; pear list shows it in the list of installed packages. But the following php file:
TobyRush
  • 654
  • 4
  • 20
1
2