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
3
votes
1 answer

Install Error PHP5-Curl Ubuntu Server

PHP 5.6.4-4ubuntu6 (cli) (built: Apr 17 2015 15:47:51) Description: Ubuntu 14.04.5 LTS Release: 14.04 apt-get install php5-curl Read package lists ... Done Dependency tree is established. Status information is read in .... Done Try…
3
votes
1 answer

"Array keys must be CURLOPT constants or equivalent integer values" using curl_setopt_array() in PHP 7

I'm building a scrape script to extract some information from a website, and while testing it out I keep getting the following error: PHP Warning: curl_setopt_array(): Array keys must be CURLOPT constants or equivalent integer values It points…
mickburkejnr
  • 3,652
  • 12
  • 76
  • 109
3
votes
1 answer

Nominatim application error PHP

I have PHP app which sends url request for geocoding as: http://nominatim.openstreetmap.org/reverse?format=xml&lat=33&lon=34&addressdetails=1 when I copy to browser returns XML respond. When same url sending from PHP file have response…
Vitali
  • 95
  • 1
  • 2
  • 6
3
votes
1 answer

PHP Curl is not loading

I have installed php curl. But still the curl module is not showing when I execute the command php -m. OS version: Ubuntu 16.04 LTS PHP version: PHP 7.0.7 Installed modules for curl: curl, libcurl3, libcurl4-openssl-dev, php-curl, php7.0-curl Please…
Achu
  • 61
  • 1
  • 6
3
votes
1 answer

Missing some CURL constants in PHP

I am trying to use constant CURL_SSLVERSION_TLSv1_2 in PHP, but I get error that such constant doesn't exist. I checked PHP manual (http://php.net/manual/en/curl.constants.php) and it says that constant is Available since PHP 5.5.19 and 5.6.3 This…
boobiq
  • 2,984
  • 2
  • 20
  • 27
3
votes
2 answers

How PHP get the content from web service?

I have a problem in getting the content/array from web service to my php code. When I type in the url in browser like http://server1-xeon.asuscomm.com/currency/?amount=1.20,from=MYR,to=SGD, then the result in the browser is displayed like this: […
JCChan
  • 465
  • 2
  • 6
  • 17
3
votes
0 answers

CURLOPT_WRITEFUNCTION Completed?

In PHP, I wish to continue processing a large XML file that has downloaded from using the CURLOPT_WRITEFUNCTION handler in cURL. I am not entirely certain how to determine when the file has completed downloading. Can anyone help with this? Is it…
MightyQ
  • 61
  • 5
3
votes
1 answer

Get a cURL command from the PHP's object

Is it possible to get the cURL command from the PHP's object? I mean, make this: $ch = curl_init('http://'.$host . $url); //... $response = curl_exec($ch); Look like this: curl -X POST -d http://www.google.com/ Is it possible? Is there a trick or…
Victor Ferreira
  • 6,151
  • 13
  • 64
  • 120
3
votes
4 answers

cURL: [P]roblem (2) in the Chunked-Encoded data

I have a PHP application that uses Guzzle to make HTTP requests. I'm getting the following exception: [curl] 56: Problem (2) in the Chunked-Encoded data [url] http://... It looks like the problem is with cURL. I've tried to compile latest version…
Slava Fomin II
  • 26,865
  • 29
  • 124
  • 202
2
votes
1 answer

Authentication failure with curl in PHP ( openssh connexion OK )

I am trying to connect via php curl on an SFTP destination, with key authentication. I manage to connect outside of curl, with openSSH: ( it work ) sftp -i myPrivateKey sftp://myusername@destination.com however, I cannot reproduce this connection…
Sacha Durand
  • 473
  • 1
  • 5
  • 11
2
votes
1 answer

PHP curl POST headers returns null on Laravel middleware with HTTPS

with http domain, it works, returning the expected output but with https, headers are null. Below is my attempt. POST CURL $fields = []; $headers = ['_token: 58SkLjsNMk0', 'Authorization: 6059DLaf39d4141' ]; $cURLConnection = curl_init('
Juliver Galleto
  • 8,831
  • 27
  • 86
  • 164
2
votes
0 answers

Fetching postman response headers in PHP cURL

I am working with an API in postman normally I use 'PHP - cURL' option in code to use it in my PHP file for getting response body. This time I need to access the headers in the response I am seeing on the postman. For example I need to see the…
2
votes
0 answers

How to handle multiple api calls using php curl

' firs api url', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, …
A. Chithrai
  • 121
  • 11
2
votes
1 answer

Make POST request from php file to another php file

I am trying to send a post request that does the excact same thing as the code below, but from a php file to another php file. In other words I want to make the post request with PHP and not Javascript. I have tried different methods but they all…
Hef
  • 606
  • 6
  • 16
2
votes
1 answer

PHP curl lower SSL security (ca md too weak error)

I am trying to send simple GET request with curl using my certificate and private keys: $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://example.com', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', …
Edgar
  • 1,113
  • 3
  • 16
  • 30