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
5
votes
2 answers

SSL certificate issue unable to get local issuer certificate

I'm trying to post data to a payment gateway API. It required post data in xml format. I have the following code: getPaymentUrl(); $amount = 100; // $block->totalOrderAmount()*100;…
P S
  • 435
  • 1
  • 8
  • 26
5
votes
0 answers

send one file and json data in a php curl multipart/form-data request

I'm trying to upload a file AND json data in a curl request in PHP. The request works fine with curl in command line. This is the curl request in command line : curl -v --basic -u'username' -F file="@documentTest.pdf;type=application/octet-stream"…
jeje
  • 121
  • 1
  • 2
  • 7
5
votes
5 answers

Call to undefined function curl_init() error

I am on a Win 64 bit OS, php 5.6.8 using Eclipse PDT to develop PHP. I have come across this Call to undefined function curl_init() error. I removed the ; preceeding extension=php_curl.dll in php.ini .Restarted the Apache server but still getting…
saurav
  • 5,388
  • 10
  • 56
  • 101
4
votes
0 answers

PHP CURL SSL routines::unsafe legacy renegotiation disabled error

I am using amazon aws with ubuntu 22.04. In my system I have installed OPENSSL version 3 and installed self signed certificate. When I am trying to make a cURL call, it works for some call and shows error SSL routines::unsafe legacy renegotiation…
4
votes
0 answers

How to get body object parameters in php curl api passed from post request in reactjs using react query?

Without using fetch api and sending data to db how we can request the body object parameters in php curl using react query e.g sample request - api.example.com/plans body- { 'mobile_no': $curlopt_fields }
alex divine
  • 121
  • 3
4
votes
0 answers

OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to NotMySite.ru:443

I get data via several proxys from external site (let it be fictional NotMySite.ru) with cURL PHP on virtual hosting. Some proxys worked nice, but some can't get data with error in topic. See full log: * Trying 45.15.237.221... * TCP_NODELAY set *…
4
votes
1 answer

GA4 custom event from server side, can someone tell me how i can do the following code in php?

const measurement_id = `G-XXXXXXXXXX`; const api_secret = ``; fetch(`https://www.google-analytics.com/mp/collect?measurement_id=${measurement_id}&`api_secret`=${api_secret}`, { method: "POST", body: JSON.stringify({ client_id:…
4
votes
2 answers

how install curl php in centos

i'm trying to install curl to my centos OS by yum when I check curl --version it shows curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.44 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 Protocols: tftp ftp telnet dict ldap ldaps http file https…
VendettaV
  • 67
  • 2
  • 7
4
votes
1 answer

cUrl working fine on localhost but it's not working on server and only shows blank page

When I run the below code on server it only shows the blank page and suddenly stop further execution, I also checked the cUrl on server which is installed. Here is my code. $ftp_server = 'ftps://'.'server/Voorraadtonen link.csv'; $ch =…
Haq Nawaz
  • 412
  • 1
  • 4
  • 12
4
votes
1 answer

Object of class CURLFile could not be converted to string

How to achieve an image upload via cURL? I am using a sandbox api for convert pdf file to .txt file. If i use "https://s3.amazonaws.com/sample.pdf" path of pdf for $sourceFile variable then its working fine. But if i use system path "test.pdf" then…
Nirdesh Kumawat
  • 386
  • 2
  • 16
  • 56
4
votes
2 answers

Display image from curl request in html tag

One of the pages of a website i'm working on should display information about a manga such as it's cover image. I'm trying to display an image I got by making a curl request.
Zubaer Rahman
  • 95
  • 1
  • 7
4
votes
0 answers

PHP curl gets stuck

I am trying to write a basic curl code in PHP. I think what I am doing is right (as far as I have read) - $url = '0.0.0.0:8080/data.php'; $data = array('username'=>'name','email'=>'abcd@gmail.com'); $payload =…
AR.walker
  • 71
  • 5
4
votes
1 answer

Why I am getting access to the admin panel without sending username and password by using php cURL

I have made a basic login form for an experiment and tried to login by using cURL. I am working with php. I have ensured that nobody can enter the main index.php page without login (authentication). But now when I tried to get access with cURL I…
S. M. Fahad Ahmad
  • 379
  • 1
  • 2
  • 11
4
votes
1 answer

Using cURL in a foreach-loop (php)

I have many HTTPS-URLS where I have to find a Special Phrase, so I´m trying to use cURL in a foreach Loop, but it´s not working. ... foreach($sites as $site) { $URL = $site; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,…
Dex Ter
  • 43
  • 1
  • 3
4
votes
1 answer

php curl_exec returns response as 1

I am trying to use curl as below code snippet. I already tried all options i could search for the similar issue. have added all setopt options availabale but still i get response as 1. I am trying post request to server and expecting json response.…
PPB
  • 287
  • 3
  • 7
  • 19
1 2
3
87 88