Questions tagged [php-curl]

1

votes
2

answer
725

Views

Amazon API get all images from product

i have simple question because don´t find any answer for this. Actually i can use Amazon´s API for get informations about product from ASIN code, but in this image´s case, i can get one single image in different formats, big, middle thumb, etc, right ? In my case i want know if it´s possible get...
Jos
1

votes
0

answer
857

Views

Failed to connect to : Connection refused - cURL PHP

So here's the scenario. 1) On my local machine that is running MAMP, I'm not facing any issue and I'm able to successfully get the response along with CURLINFO_HTTP_CODE=200 2) However, there is a remote server on which my PHP code is deployed. If I try to run the same thing (as I've mentioned in #1...
Abhilash
1

votes
0

answer
32

Views

PHP cURL gives error at crontab, but through ssh it works perfect

I've made a php script, that i want to excecute on my ubuntu 16.04 machine. I am working with php 7 and i use crontab. When i run the command which php this is the output: /usr/bin/php Now my script is uploading a picture on a website. I use PHP curl for that. This is my cURL setup $ch = curl_init()...
user82887
1

votes
0

answer
85

Views

Function does not exit after foreach loop and realod function

I have a function in php that this function connect to multiple API and get data from this multiple API and insert into database. but when function get data from last API , function does not exit. function reload and get data from multiple API again. why function reloaded ? note : this function wor...
David
1

votes
1

answer
532

Views

Getting and setting Cookies in PHP Curl Serverside

During login to an API I am receiving some server settings via CURL. I have the following script that extracts the Cookies received. I need the following Curl call to send the cookies received with the first call - somehow I cant get it working: After this I want to call another API service and send...
Peter Kroul
1

votes
0

answer
621

Views

Upload files to my rest api

I want to upload file to my google cloud storage with my rest api with php curl with this php code if( $_SERVER['REQUEST_METHOD'] == 'POST' ){ $file = $_FILES['files']; $fileName = $file['name']; $fileType = $file['type']; $fileTmp = $file['tmp_name']; $curl = curl_init(); curl_setopt_array($curl,...
alaa nabawy
1

votes
1

answer
55

Views

PHP Curl emulate web browser request to Endomondo

I have read several posts regarding this issue, but I simply cannot crack this nut. I’m trying to make PHP Curl emulate this web browser request: https://www.endomondo.com/embed/user/workouts/?id=747232&measure=0&width=450&height=400&page=0&language=DA (I have removed all cookies prior to this req...
kWalk
1

votes
0

answer
229

Views

Send xml request to webservice from php

I am trying to send a xml-request to a webservice from PHP, using curl. I do not know much about the webservice. When I am running this code, the result allways seams to be 'Completed with no errors.' The xml should be valid for the webservice, but I am not able to get a response. If i dump $data it...
Tankegang
1

votes
0

answer
86

Views

Why I can't used php curl that I generate from Postman in my project?

I sent request with attached csv file by postman . I got the right response from web service . but when I generated php curl from postman to my project with upload file form . I got error from the response . It seemed Web service can received csv file but It can't use the file because Web service r...
stevieki
1

votes
0

answer
241

Views

Upload files to google cloud storage (php curl)

Hi i have created my google cloud storage account to use it to store videos and files, i use this rest api ( http://acquired-backup-198200.appspot.com/[email protected] ) The file uploaded by sending it in the request body ( filename = file ) when i tried to use postman to do that it's suc...
alaa nabawy
1

votes
1

answer
141

Views

Set a global PHP-CURL Upload & Download Speed limit?

I use CURL in several individual PHP scripts to download / upload files, is there a way to set a GLOBAL (not per-curl-handle) UL / DL Rate Speed Limit? Unfortunately, you can only set a speed limit for the single session at CURL, but that's not dynamic. As a server OS Ubuntu is used, is there an alt...
k.hubenbecker
1

votes
1

answer
110

Views

Curl with basic auth and sending of json data

Im using this code in my command prompt to test if i can have the authorization to send data to the given url to me. curl --header 'Authorization':'base64' -H 'Content-Type: text/html; charset=UTF-8' -H 'Accept: application/json' -X POST -d '{'firstname':'test','lastname':'test','mobile_number':0999...
Gian
1

votes
1

answer
182

Views

curl_multi_exec: some images downloaded are missing some data / stream incomplete

I have implemented a PHP function which checks & downloads a lot of images (> 1'000) - as passed to it using an array - using the PHP curl_multi_init() method. After reworking this a few times already, because I was getting things like 0 bytes files, etc. I have a solution now which downloads all im...
Oliver
1

votes
1

answer
517

Views

php 7.2 and libcurl

php 7.2 as i think use libcurl with version 4 but when I set this version of libcurl in my Ubuntu, some programs became not working and more than this, system try to delete these programs. They are at least: Viber, Joxi and so on, and a lot of libraries which not works if libcurl3 is not installed B...
Ilya Kolesnikov
1

votes
1

answer
217

Views

Execute multiple parallel cURL against the same URL?

I need to execute 2 requests in parallel using cURL to get a reply from the web service. The problem is that I need to get the encrypted password from the first XML's output and pass it to the second XML to get 100 success response from the API. Currently, I have created 2 cURL to achieve this but...
user2672112
1

votes
1

answer
70

Views

PHP curl in a functions does not return antyhing

I have an API url that needs to be executed, it returns either the state of something or an id that you can check the state and get the result based on the id. I wrote a function to execute CURL, but it does not return any results..
PaaPs
1

votes
0

answer
69

Views

InfusionSoft: API error While Fetching contact Details

I'm working on InfusionSoft API (documentation here) and making request by using CURL (no API SDK) but getting the following error. Failed to parse XML-RPC request: Premature end of file. any help would be appreciated. Below is the CURL code that I'm using. $url_token = 'http://api.infusionsoft.com...
muaaz
1

votes
0

answer
102

Views

Sending an Image to an API using Curl

I have been very frustrated in my attempt to send an image to an API using Curl. The image is coming from an html form from the clients end. When the form is submitted, I check to make sure the file is an image and the image is moved to an uploads folder as such: $location = 'ImageUploads/'; if(isse...
Mike Sheck
1

votes
0

answer
64

Views

PHP curl switches between outdated (cached?) and up-to-date results back and forth

Ok, this is a poor question in terms of lack of reproducibility, but I really need some advice, so please bear with me. I have a simplistic PHP script which is used to proxy a static CORS-disabled page to a script. The page is a 'pubhtml' version of a google spreadsheet ('File → Publish to the web...
YakovL
1

votes
1

answer
1.1k

Views

Send POST Request & Get JSON Response in PHP?

I'm trying to send a POST request via PHP from AJAX. I checked the API with Postman. It is working fine. But it is not getting executed in PHP. It is not showing up in Network Tab also. I saw a lot of samples for making a POST Request in Stack Overflow & tried it. But I can't figure out where I'm g...
user3467240
1

votes
1

answer
31

Views

How to obtain data from an external web page with curl through POST requests

I have previously made a code that allows me to make an inquiry to an external web page where I sent by GET the id and it shows me the name and surname of a person. That code works very well, is this: function nome($id) { $url = 'https://www.dateas.com/es/consulta_cuit_cuil?name=&cuit='.$id; $ch = c...
RolandF
1

votes
1

answer
204

Views

Guzzle Bearer Authorization header cannot be setted to request

I am trying to set an Authorization header with Guzzle/6.2.0 on Ubuntu 18.04.1. But I cannot set it. Can anyone help me with this problem? I have following code: use GuzzleHttp\Client; $url = 'my_url'; $client = new Client(); $response = $client->get( $url, [ 'headers' => [ 'Authorization' => 'Bear...
dan danny
1

votes
0

answer
152

Views

How to use curl to get streaming data from twitter in php

I trying to get streaming data from twitter, I found curl in twitter developer section to get streaming data $ curl --request GET --url 'https://api.twitter.com/1.1/search/tweets.json?q=nasa&result_type=popular' --header 'authorization: OAuth oauth_consumer_key='consumer-key-for-app', oauth_nonc...
Ashutosh Roy
1

votes
0

answer
25

Views

Big curl_multi requests or multiple little curl requests (php)

I have to update 106600 data using a REST API but I don't know the most optimized way to do this. The main difficulty is that the API return data 100 per 100 and I must use offset to have all them all (1066 API calls). After that, I have to retrieve extra data for each off these data. It mean 1066 o...
Gotrek
-1

votes
1

answer
578

Views

Scraping a dynamically loading website with php curl

I am new to scraping and have scrapped two websites formally. But the problem appeared to me when I tried to scrape dynamic loading websites. When the website is rendered with JavaScript, I am unable to scrape the contents of the website then. Is there any way I can scrape the contents of that webs...
Shehny Khan
1

votes
0

answer
53

Views

php-curl not sending Authorization header after redirect

I'm using PHP 7.2 and cURL 7.53.1. I'm trying to use Google's NEST REST API. I try a CURL request like this: curl_setopt_array($curl, array( CURLOPT_URL => 'https://developer-api.nest.com', CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION=>true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10...
Jesse Parker
1

votes
0

answer
32

Views

Send PDF File to API Using PHP CURL Got File 0 Byte After Upload

I'm send file type PDF and Json to API server, but for the file PDF after upload like corrupt the file size is 0 byte and it can't be open. I try send post with PHP CURL where the code generate from Postman, but if i send with postman POST the file is fine (not damage, can open)
Lazar
1

votes
0

answer
41

Views

FCM Data Message not deliver to devices

I am using php to send fcm data message from to topics anytime i send message i get the response below. {'message_id':8846044152001290063} i don't really know if this mean failure or success also below is my php function used to send notice from server. function pushNotice($title, $topic, $message,...
idris muhammad
1

votes
0

answer
32

Views

Using cURL twice on same page, first to authorize then to get data

I have the following code for a cURL request to authenticate as a first step: $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.example.com/v1/api2/login?grant_type=client_id', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIM...
devManMan
1

votes
2

answer
68

Views

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 frequent error, and tried the following, without succes...
Michaël Vreux
1

votes
0

answer
81

Views

curl php HTTP/2 stream 0 was not closed cleanly

I am trying to send a request using cURL and PHP and it throws an error. HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1) I am sending CURLOPT_HTTP_VERSION like this curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0); cURL info printed with curel_version() is Array ( [versio...
Mubin
1

votes
0

answer
20

Views

php curl proxy + follow redirect

i'm sending a curl request to a webpage that redirects 3 times when i use curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); it works well and responses with the last url & body in the third redirect .. but when i use proxy curl_setopt($ch, CURLOPT_PROXY, $host); curl_setopt($ch, CURLOPT_PROXYPORT, $po...
Dola09
1

votes
2

answer
30

Views

PHP CURL How to filter json results?

in need to filter my curl json requests. My problem is.. my ouput list is allways the complete JSON list (Link 1-3). I need to request only Link 1 & Link 3. Please check my filter example $responseData = apiRequest('link/list', array('id' => json_encode(array('1001', '1003')))); This filter does not...
Veltins
1

votes
0

answer
24

Views

phpcurl cannot put to Amazon s3

If I PUT to Amazon S3 using curl the request and response work. Using phpcurl I get a SignatureDoesNotMatch error. But the signature is the same in either case I think. Below I have the curl request and the php request. curl request PUT long_amazon_url_here Host: s3.amazonaws.com User-Agent:...
zortacon
0

votes
0

answer
5

Views
2

votes
1

answer
123

Views

Laravel backup error uploading large backup to s3

I have a Laravel project that creates a new backup daily using spatie/laravel-backup and uploads it to s3. It is properly configured, and it has been working for over a year without a problem. Suddenly, the backup can't complete the upload process because of the following error: Copying zip failed b...
gbalduzzi
1

votes
1

answer
766

Views

curl_exec distinguish cause of timeout

In PHP, curl_exec there are multiple options that you can use to abort a request that is taking too long, CURLOPT_TIMEOUT, CURLOPT_CONNECTTIMEOUT, CURLOPT_LOW_SPEED_TIME etc. I believe the errno for all these cases is 28 (which just indicates that the operation timed out), does libcurl report anythi...
Gregory Nisbet
1

votes
1

answer
599

Views

php-curl incorrect header size when use proxy

This code: $headersSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); $responseHeaders = substr($response, 0, $headersSize); $responseBody = substr($response, $headersSize); return incorrect size (strlen) of headers, e.g. here: ... Pragma: no-cache Set-Cookie: foo=bar; pat ---- curl want split...
Deep
1

votes
2

answer
979

Views

Mailchimp api v3 : Batch subscription always pending

I've been trying the mailchimp API in it's v3. Since I used php I had some trouble to start but now quite everything goes well. I'm trying to add multiple subscribers to my list, in one go. I looked there : https://devs.mailchimp.com/blog/batch-operations-and-put-in-api-v3-0/ and tried the following...
LamaDelRay
1

votes
2

answer
933

Views

Android push Notification through firebase (server side)

I am trying to send push notification to my android device from server using firebase cloud messaging system. I was able to successfully register my device and token for my device was generated as well. I am having trouble sending notification to my device using the below script Now whenever i hit...
Sriram

View additional questions