php-curl

curl php HTTP/2 stream 0 was not closed cleanly

◇◆丶佛笑我妖孽 提交于 2019-12-06 12:34:20
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 ( [version_number] => 475136 [age] => 4 [features] => 11518877 [ssl_version_number] => 0 [version] => 7.64.0 [host] => x86_64-apple-darwin18.2.0 [ssl_version] => OpenSSL/1.0.2q [libz_version] => 1.2.11 [protocols] => Array ( [0] => dict [1] => file [2] => ftp [3] => ftps [4] => gopher [5] => http [6] =>

File uploading through curl in php

痴心易碎 提交于 2019-12-06 11:01:29
I am trying to upload a file through curl on another server. I have created a script for this, but I am not able to get the $_FILES parameter. It's empty. $request = curl_init('http://localhost/pushUploadedFile.php'); $file_path = $path.$name; curl_setopt($request, CURLOPT_POST, true); curl_setopt( $request, CURLOPT_POSTFIELDS, array( 'file' => '@' . $file_path, 'test' => 'rahul' )); curl_setopt($request, CURLOPT_RETURNTRANSFER, true); echo curl_exec($request);exit(); pushUploadedFile.php: print_r($_FILES['file']); What version of PHP are you using? In PHP 5.5 the curl option CURLOPT_SAFE

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

假装没事ソ 提交于 2019-12-05 16:09:07
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 extension=php_curl.dll reload apache server and in error_log I have [22-Sep-2015 13:13:30 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.29/ext/php_curl.dll' - Impossibile trovare il modulo specificato.in Unknown on line 0 The DLL is on the correct folder and the other DLLs work fine. 1° try : I added in system var

Curl - Request with wp_remote_get() responds 500, curl_exec responds 200

泄露秘密 提交于 2019-12-05 06:35:34
问题 I am getting an odd server php curl error in both my local and production servers ( Ubuntu 14.04.2 LTS, PHP 5.5.9-1ubuntu4.11, Apache 2.4.7 ). Basically, a curl request to a remote API returns a status code 500 response, ONLY in wp_remote_get() , where it returns status 200 in both curl_exec() and a browser request. My debug code: <?php $url = 'https://yoast.com?edd_action=activate_license&license=my-license-key-here&item_name=WooCommerce+Yoast+SEO&url=https://google.com'; // this return

Curl - Request with wp_remote_get() responds 500, curl_exec responds 200

为君一笑 提交于 2019-12-04 21:14:52
I am getting an odd server php curl error in both my local and production servers ( Ubuntu 14.04.2 LTS, PHP 5.5.9-1ubuntu4.11, Apache 2.4.7 ). Basically, a curl request to a remote API returns a status code 500 response, ONLY in wp_remote_get() , where it returns status 200 in both curl_exec() and a browser request. My debug code: <?php $url = 'https://yoast.com?edd_action=activate_license&license=my-license-key-here&item_name=WooCommerce+Yoast+SEO&url=https://google.com'; // this return status 200: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION

How to share on LinkedIn using REST-API v2?

心已入冬 提交于 2019-12-04 18:36:02
I am having difficulty getting a share on linkedin. I am trying to post a LinkedIn share via linkedin api v2 and everytime I make the post request I get a request timed out (status 504) answer from the server. Here is my code : $url = https://api.linkedin.com/v2/ugcPosts?oauth2_access_token=".$row[0]['accesstoken']; $fields = '{ "author": "urn:li:person:XXX", "lifecycleState": "PUBLISHED", "specificContent": { "com.linkedin.ugc.ShareContent": { "shareCommentary": { "text": "Hello World! This is my first Share on LinkedIn!" }, "shareMediaCategory": "NONE" } }, "visibility": { "com.linkedin.ugc

Composer install missing curl-ext

对着背影说爱祢 提交于 2019-12-04 03:36:38
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 outputs: PHP 5.6.23-1+deb.sury.org~trusty+2 (cli) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies Running which php outputs: /usr/bin/php which is kind of suspicious as it doesn't match php -v (/usr/bin has: "php", "php5", and

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

家住魔仙堡 提交于 2019-12-04 00:27:50
问题 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 one to have server-side code in the middle that would be queried by the AJAX, and would handle the actual API call. I'm OK working directly with the API from AJAX, but I'm unsure of how to work with a two-step process in order to hide the token

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

非 Y 不嫁゛ 提交于 2019-12-03 01:14:59
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 python3-certbot-nginx I could re-install imagick and certbot without issue, but if I try to install php7.2-curl I get the message: # apt install php7.2-curl -y Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are

How to get JSON data from Rest API by PHP Curl?

只愿长相守 提交于 2019-12-02 10:56:13
问题 I have a Rest api which I can access by this url: "http://127.0.0.1:8000/api/thesis/?format=json". Now I want to get the JSON data from it. For connecting to the api I tried to use PHP-Curl as below. But I get NULL! (This is the first time I'm doing php any help will be great!) <?php $service_url = "http://127.0.0.1:8000/api/thesis/?format=json"; //initialize a curl session $curl = curl_init(); //set options for the transfer curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl,