php-curl

create pastes inside folder with pastebin.com api?

*爱你&永不变心* 提交于 2020-02-07 03:56:09
问题 after creating a folder on pastebin.com, how do i upload pastes to that folder with the api? i couldn't really find any mention of folders in the API documentation at https://pastebin.com/api (in fact, the word folder does not appear in the the documentation at all, running curl 'https://pastebin.com/api' -s | grep -i folder | wc -l returns 0), i want to do it with php + the curl_ api if that's significant (but i doubt it is) 回答1: this is obviously not a good solution, but it was the only one

How to send raw data with curl GET in PHP?

流过昼夜 提交于 2020-02-06 06:35:05
问题 I am developing REST API and while it is easy to set raw JSON data for request in cURL for POST $payload = json_encode(array("user" => $data)); //attach encoded JSON string to the POST fields curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); I cannot figure out how to send such data with GET requests. Is there something like CURLOPT_GETFIELDS or CURLOPT_RAWDATA ? The purpose of sending JSON with GET request is to pass in some params. I do not wish to add formdata to the request, I wish to post

What is wrong with this CURL call in PHP? [closed]

谁说我不能喝 提交于 2020-01-17 21:34:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . $POSTFIELDS = array( 'email' => "fodil@usa.com", 'phone' => "656565465422", ); curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents("php://input") . "&" . $POSTFIELDS); I can't figure what is wrong with this, it doesn't work, I tried many things but can't make it work... 回答1: You are passing post fields in a

PHP cURL suddenly not loading on Windows 10 Pro

北慕城南 提交于 2020-01-06 06:40:56
问题 A simple php_curl example isn't working anymore on my Windows 10 laptop. It was working before. Fatal error: Uncaught Error: Call to undefined function curl_init() in C:\Users\path\curl.php:3 Stack trace: #0 {main} thrown in C:\Users\path\curl.php on line 3 My C:\php7\php.ini has extension=C:\php7\ext\php_curl.dll php_curl.dll exists in C:\php7\ext PHP Version 7.0.30 Windows 10 Pro Version 1607 Build 14393.2189 But my loclahost/phpinfo.php does not have cURL. How come all of a sudden it

php-curl incorrect header size when use proxy

喜欢而已 提交于 2020-01-06 02:59:24
问题 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 here ---- h=/ Access-Control-Allow-Origin: * <!DOCTYPE html ... Response can have multiple headers (redirections, continue, etc.). And ofcourse like this isnt work: list($header, $body) = explode("\r\n\r

URL error 0: The cURL request was retried 3 times and did not succeed

纵然是瞬间 提交于 2019-12-29 08:53:04
问题 I am working on a project that is hosted on Google App Engine, and using app_devserver for local development. At the start I had problems with certificates but when I finally got over that error I am getting this new error I am using Windows 10 and PHPstorm for development. Error: Message: cURL error 0: The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in

Why curls fails to verify google access token whereas browser succeeds?

落花浮王杯 提交于 2019-12-25 02:07:12
问题 with this simple code I manage to get Google's access tokens. See the code: public function authenticate($code = null) { if (!$code) { if ($this->log) error_log(__CLASS__ . '::authenticate() error: $code is null.'); return false; } $client_id = $this->token->get('client_id'); $client_secret = $this->token->get('client_secret'); $redirect_uri = $this->token->get('redirect_uri'); $url = $this->token->get('token_endpoint'); $curlPost = 'client_id=' . $client_id . '&client_secret=' . $client

PHP: Do I need to use cookies in this cURL script?

南笙酒味 提交于 2019-12-25 01:55:17
问题 The following script: <?php $sDataFile = '<path>\journal-issue-ToC.htm'; $sURL = 'https://onlinelibrary.wiley.com/toc/14678624/2014/85/1'; $bHeader = false; $sCAinfo = '<path>\cacert.pem'; $cURLhandle = curl_init(); $FilePointer = fopen($sDataFile, 'wb'); curl_setopt($cURLhandle, CURLOPT_URL, $sURL); curl_setopt($cURLhandle, CURLOPT_FILE, $FilePointer); curl_setopt($cURLhandle, CURLOPT_HEADER, $bHeader); curl_setopt($cURLhandle, CURLOPT_CAINFO, $sCAinfo); curl_exec($cURLhandle); curl_close(

LinkedIn API V2 - How to upload photo as binary file

房东的猫 提交于 2019-12-24 16:51:28
问题 I'm having trouble with the second step of uploading a post with a photo seen here. $post_fields = array( 'file' => '@' . $_FILES['file-attachment']['tmp_name'] . ';filename=' . $_FILES['file-attachment']['name'] . ';type=' . $_FILES['file-attachment']['type'] ); $upload_response = process_curl(array( CURLOPT_URL => $upload_url, CURLOPT_HEADER => false, CURLOPT_TIMEOUT => 10, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_POSTFIELDS => $post_fields, CURLOPT_HTTPHEADER => array('Authorization:

guzzle exception with .localhost domains

元气小坏坏 提交于 2019-12-24 10:11:03
问题 On my local machine I have two services (in laravel 5): userBox and mailBox. mailBox use userBox during login using library "guzzlehttp/guzzle": "~6.0" and restful API (mailBox send user credential and get info do user exists and have proper access). After .dev subdomains stopps working I decide to use .localhost subdomain so i have: userbox.localhost mailbox.localhost I make changes in /etc/apache2/extra/httpd-vhosts.conf but unfortunatley I get error: cURL error 6: Could not resolve host: