Questions tagged [php-curl]

PHP cURL extension for HTTP requests

PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication.

These functions have been added in PHP 4.0.2.

Source

1306 questions
145
votes
4 answers

How to use CURL via a proxy?

I am looking to set curl to use a proxy server. The url is provided by an html form, which has not been a problem. Without the proxy it works fine. I have found code on this and other sites, but they do not work. Any help in finding the correct…
user586011
  • 1,908
  • 4
  • 18
  • 29
87
votes
8 answers

How to install php-curl in Ubuntu 16.04

Upgraded to Ubuntu 16.04 and facing problem after installing PHP5. Installed PHP-5 with following: sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get upgrade sudo apt-get install php5.5 # for PHP 5.5 Trying to install…
Govind Samrow
  • 9,981
  • 13
  • 53
  • 90
50
votes
1 answer

Build working libcurl with WinSSL, NTLM, HTTP2, SSH2 and IPv6 support

In our PHP application, we need the PHP curl-extension built in a way, that it supports the following features: WinSSL (Access to the Windows certificate store) NTLM, Basic and Digest authentication HTTP/2 support SSH2 support IPv6 support I've…
Jost
  • 5,948
  • 8
  • 42
  • 72
31
votes
4 answers

After Ubuntu 18.04 upgrade php7.2-curl cannot be installed

Upgraded to 18.04 from 16.04 today using do-release-upgrade -d During the upgrade I was informed that some packages would be removed, these included: Remove: libperl5.22 lxc-common perl-modules-5.22 php-imagick php7.1-curl php7.2-curl…
Arni J
  • 385
  • 1
  • 4
  • 9
31
votes
3 answers

How to convert Php CURL request to command line curl

How to translate following php curl request to curl executable command. $curlOpts = array( CURLOPT_PORT => "3000", CURLOPT_URL => 'www.example.com', …
HItesh Tank
  • 636
  • 1
  • 6
  • 13
28
votes
6 answers

TLS 1.2 not working in cURL

I am having trouble curling an HTTPS url that uses TLS1.2, in my curl operation I post my login data into the website and save it in cookiefile. The error message I am getting is this error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert…
Sam Ash
  • 397
  • 1
  • 3
  • 4
24
votes
1 answer

What does curl_exec return?

I'm trying to set an API with a payment processor. Below is the code they provided me. There are some information in the $result variable that I want, what I don't understand is what type of variable is '$result' and how can I take certain data from…
shadyhossin
  • 575
  • 1
  • 6
  • 16
22
votes
4 answers

A problem occurred somewhere in the SSL/TLS handshake

I've been having problems on my development server where cURL, while working perfectly with anything HTTP, does not function properly with anything HTTPS—even the exact same resource with different protocols (for testing I've been requesting…
spezied
  • 221
  • 1
  • 2
  • 3
18
votes
6 answers

PHP cURL, read remote file and write contents to local file

I want to connect to a remote file and writing the output from the remote file to a local file, this is my function: function get_remote_file_to_cache() { $the_site="http://facebook.com"; $curl = curl_init(); $fp =…
Ryan
  • 9,821
  • 22
  • 66
  • 101
16
votes
7 answers

PHP Warning: PHP Startup: Unable to load dynamic library php_curl.dll impossibile find

I have Windows 10 with WAMP server (Apache 2.4.9, PHP 5.5.29 VC11 x64, e MySQL). All works fine, but now I will use curl extension. I go into C:\wamp\bin\php\php5.5.29\phpForApache.ini (from webserver configuration) and remove the comment from…
lbottoni
  • 962
  • 2
  • 14
  • 26
13
votes
1 answer

How to use PHP cURL with HTTP/1.1

My server cURL version is newer then client's version when doing remote call, client's server automatically switches to http/2, Is there any way i can force to use curl with http/1.1 How to set cURL HTTP version to 1.1, I tested by adding following…
Viral
  • 1,329
  • 1
  • 9
  • 31
12
votes
2 answers

PHP curl Connection timed out error

I am calling an API using curl in PHP, Sometimes it works fine and sometimes I get Failed to connect to api-domain.com port 80: Connection timed out It's a little strange that sometimes it's working and sometimes it's not. To troubleshoot the issue…
Irfan.gwb
  • 668
  • 2
  • 13
  • 35
12
votes
6 answers

Secure API calls with AJAX and PHP to 3rd party API

I want to make GET, POST & PUT calls to a 3rd party API and display the response on the client side via AJAX. The API calls require a token, but I need to keep that token secret / not in the client-side JS code. I've seen a few suggestions like this…
t-jam
  • 811
  • 1
  • 6
  • 21
9
votes
2 answers

Curl options equivalent to "useDefaultCredentials" by Net.Webclient

I try to access to the web with curl in a php script : $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://www.google.fr"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' .…
Alsatian
  • 3,086
  • 4
  • 25
  • 40
9
votes
3 answers

Composer install missing curl-ext

I am developing some PHP on Ubuntu 14.04.4 LS. Running composer install is failing and I can't figure it out. This was working earlier when I was using PHP 5.5.9, but I had to update to at least 5.6 in order to install phpunit. Running php -v…
Alan P.
  • 2,898
  • 6
  • 28
  • 52
1
2 3
87 88