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

PHP cURL missing some of the response cookies

I am trying to scrape a shopping cart which uses the cookies for different currencies. When I load the site in chrome browser and inspecting with Cookie Inspector for Chrome, it shows the following cookies. When I try loading the same link with…
dharanbro
  • 1,327
  • 4
  • 17
  • 40
8
votes
1 answer

LibCURL sends filename rather than file contents when I try to upload a binary file in Windows Server 2008

I'm getting this weird behavior with libCURL. When I try to upload a file by appending "@" to the beginning of filename (as documented in libCURL's man page), instead of file contents being uploaded, libCURL sends the filename itself (with the @ in…
bodacydo
  • 75,521
  • 93
  • 229
  • 319
8
votes
1 answer

How can I detect URL Not Found Error in php curl?

How can I detect this error using php curl? curl return success even if the URL does not exist. Not Found The requested URL /foo/index.php/items/edit was not found on this server. My code $post_fields = array('info' => json_encode($fields)); …
Harikrishnan
  • 9,688
  • 11
  • 84
  • 127
7
votes
1 answer

PHP HTTP 426 - file_get_contents vs. curl

I have a simple PHP script, which sends a GET request with some parameters to an external API, and receive some json data in response. I used file_get_contents for this, and it worked for the last months. Example: $url =…
HectorLector
  • 1,851
  • 1
  • 23
  • 33
7
votes
2 answers

Use of undefined constant CURLOPT_TCP_FASTOPEN

If i use the CURLOPT_TCP_FASTOPEN option in my code , then i get the following error. Use of undefined constant CURLOPT_TCP_FASTOPEN - assumed 'CURLOPT_TCP_FASTOPEN' The CURLOPT_TCP_FASTOPEN is a supported option in php 7.4.5 interface . php…
user2650277
  • 6,289
  • 17
  • 63
  • 132
7
votes
2 answers

Can't access IBM Tone Analyzer API?

I'm trying to use the Tone Analyzer API in a Laravel application. No matter what I try, I always get the same response of {"code":401, "error": "Unauthorized"}. I suspect my issue is that I can't figure out how to pass in the API key, but the…
Jess
  • 307
  • 1
  • 2
  • 11
7
votes
0 answers

GnuTLS recv error (-54): Error in the pull function

I have a PHP scraper that works perfectly on my local. But when I uploaded it to my VPS (Ubuntu 16.04), it's not able to get data from the website. Instead, it's showing this error message: "curl: (56) GnuTLS recv error (-54): Error in the pull…
Fatih Köse
  • 121
  • 1
  • 6
7
votes
5 answers

cURL not working sometimes and gives empty result

I used cURL to get data from another website. Sometimes it shows data and sometimes empty result Here is my Code function get_data($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); …
Vignesh
  • 71
  • 1
  • 4
6
votes
2 answers

Guzzle TransferStats HandlerStats documentation/explanation?

In Guzzle documentation you can find a request option callable called on_stats which allows you to get access to transfer statistics of a request and access the lower level transfer details of the handler associated with your client. This…
RTB
  • 5,773
  • 7
  • 33
  • 50
5
votes
0 answers

PHP CURL failed with Operation timeout in Kubernetes CronJob

I have a cronJob that runs at some time interval to download images from remote servers. I had alpine-php:7.2-fpm docker image. It works fine with some of the URLs. but it is failing with some URLs. Here is the code for CURL $fp =…
Kathak Dabhi
  • 399
  • 3
  • 16
5
votes
2 answers

PHP + Curl: Connection closure while negotiation auth (HTTP 1.0?)

I have a problem between CURL and PHP. I tried to connect to an Exchange 2010 Server via EWS. The connection to the server works fine in command line using CURL but not with PHP Curl extension. I attached an image with the debug information. On the…
Tobias Bambullis
  • 736
  • 5
  • 17
  • 45
5
votes
2 answers

SSL certificate problem: unable to get issuer certificate

I'm currently testing an API on a website with a certificate by executing a php script that uses curl, in command line on my local windows machine. But the script never manages to reach the server. I have looked up solutions for this apparently…
Michaël Vreux
  • 316
  • 1
  • 2
  • 14
5
votes
2 answers

Text magic sms API getting error on Godaddy shared hosting

I am tryng to send SMS using Textmagic from godaddy using php. I have used the official git-hub page to get API https://github.com/textmagic/textmagic-rest-php The above setups works fine from my local Ubuntu PC and able to send SMS, Where as when I…
CodeDezk
  • 1,230
  • 1
  • 12
  • 40
5
votes
1 answer

What is different between set opt CURLOPT_USERAGENT and set useragent in header field curl php?

someone please help me know the difference about setting opt in curl php. $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "abcxyz", CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array( "Accept:…
5
votes
1 answer

MailGun 401 response forbidden where am i going wrong

I have 2 scripts for mailgun api the one i wrote returns 401 forbidden the one i found online works perfect i tried both with the same domain/api key this one works copy paste from github gist this one works like a charm
YesItsMe
  • 1,709
  • 16
  • 32
1
2
3
87 88