FAQ Database Discussion Community


Python http get - cannot replicate a curl request with headers

python,curl,http-headers,urllib2,http-get
I have the following curl command: curl -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Connection: keep-alive" -X GET http://example.com/en/number/111555000 Unfortunately I was not able to replicate it... I tried with: url = http://example.com/en/number/111555000 headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0',...

How to do proper jQuery user authentication with AJAX

javascript,jquery,ajax,curl
I am stymied by a simple exercise. I have a REST api server that requires user authentication. A cURL command shows it working: curl -k --user [email protected]:Lannister https://miramar21.com/tut_server/default/api/verify/person/[email protected]/Prometheus To do this from jQuery, then, should be simple: $.ajax ({ type: "GET", url: "https://miramar21.com/tut_server/default/api/verify/person/[email protected]/Prometheus", dataType: 'json', async: false, headers: { "Authorization":...

compare python requests with curl

python,curl,python-requests
I am interfacing with an API using requests and requests_oauthlib. I successfully authenticate and access all the GET methods of the API, but get error 500 with POST methods. For example: r = oauth.post("https://api.timelyapp.com/1.0/1/clients", data={"client":{"name":"newclient", "color":"c697c0" }}, allow_redirects=False, headers={"Content-Type": "application/json"}) The issue is that I tested the same exact call...

download file sftp with curl running out of memory [duplicate]

php,curl,sftp
This question already has an answer here: Downloading a large file using curl 4 answers How to avoid this error Fatal error: Allowed memory size of 209715200 bytes exhausted The files are very large (over 5gb) $host = 'domain.com'; $pass = 'xxx'; $remote = "sftp://root:[email protected]$host/var/www/test.txt"; $local = 'C:\wamp\www\test.txt'; $curl...

Dashing dashboard won't display on Windows

ruby,curl,sinatra,dashing
I ran exactly the following: dashing new project cd project bundle install && dashing start It listed the "using" output and began the server. Output here. Visiting localhost:3030 resulted in a plain grey web page with nothing on it but the text Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text":...

curl ignore --data starting with @ sign: don't read from file

http,curl,slack-api
In slack you can script slackbot to post messages to a channel like this: curl --data "$msg" $'https://<yourteam>.slack.com/services/hooks/slackbot?token=<yourtoken>&channel=#random' Now i'd like to mention a username as the first part of the message like msg="@joernhees hello self". The problem with this is that if the --data argument of curl starts with...

download file with curl via sftp

php,curl,sftp
This only creates an empty file.. No content in the file $host = 'domain.com'; $pass = 'xxx'; $remote = 'sftp://var/www/test.txt'; $local = 'C:\wamp\www\test.txt'; $curl = curl_init(); $file = fopen($local, 'w'); curl_setopt($curl, CURLOPT_URL, $remote); curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_SFTP); curl_setopt($curl, CURLOPT_USERPWD, "root:$pass"); curl_setopt($curl, CURLOPT_FILE, $file); curl_exec($curl); curl_close($curl); fclose($file); solution $host = 'domain.com'; $pass...

API Integration

xml,api,curl
Im new here and Im not a programmer but learning along the way. I have come up against a problem but in your explanation (if any - thanks) dont presume that I know. Hope you can help me solve this. Here are the details: Im trying to integrate Interpire EmailMarketer...

bash script grep using variable fails to find result that actually does exist

bash,curl,sed,grep,carriage-return
I have a bash script that iterates over a list of links, curl's down an html page per link, greps for a particular string format (syntax is: CVE-####-####), removes the surrounding html tags (this is a consistent format, no special case handling necessary), searches a changelog file for the resulting...

Understanding curl request

curl
I got following line along with the response. How to force that connection is closed after the response? Connection #0 to host localhost left intact curl command: curl -v --user uname:password -H "Accept: application/xml" http://localhost:8090/services/VariableService/variableService/...

CURL to POSTMAN

api,curl,http-headers,postman
$ curl https://api.blockscore.com/question_sets/536c1532627463780b000000/score \ -u sk_test_n5049aa6053c9a0217bea78070fbf501: \ --header "Accept: application/vnd.blockscore+json;version=4" \ -d 'answers[][question_id]=1' \ -d 'answers[][answer_id]=3' \ -d 'answers[][question_id]=2' \ -d 'answers[][answer_id]=2' \ -d 'answers[][question_id]=3' \ -d 'answers[][answer_id]=2' \ -d 'answers[][question_id]=4' \ -d 'answers[][answer_id]=2' \ -d 'answers[][question_id]=5' \ -d 'answers[][answer_id]=5' how to set this parameters in getpostman? what is...

Using curl to POST obtains a different response than when using requests to POST

python,curl
I am new to python programming and I have reached an impasse that I can't seem to solve. I am trying to use python requests module to to POST a request to a service in IBM Bluemix. It works fine when I use cURL to make the request but when...

X-Insta-Forwarded-For Error Instagram API using PHP cURL

javascript,php,curl,instagram,instagram-api
I'm trying to make a post to instagram using this api and the POST method of relationships. Here is the side-server code I'm using: <?php $url = "https://api.instagram.com/v1/users/<user>/relationship"; $ips= (isset($_SERVER['SERVER_ADDR'])) ? $_SERVER['SERVER_ADDR'] : gethostbyname(gethostname()); $signature = (hash_hmac('sha256', $ips, '<secret>', false)); $join = join('|', array($ips, $signature)); $headerData = array('Accept: application/json'); $headerData[]...

Display PNG image in php webpage from API result

php,api,curl
This question was created because my last question was marked as a duplicate when it wasn't a duplicate. I have a GET API call that is returning back a UTF-8 PNG image. I am making the call from PHP and want to display the PNG thumbnail embedded in the webpage....

Does cURL increase bounce rate on Google Analytics report?

php,curl,google-analytics
While developing website up time monitoring application, I do send a cURL request to see whatever the site is running or down, If down then it also try to detect the reason. Therefore I send a cURL request. But my question is, does Google Analytics count it under bounce rate?...

Sending XML in Curl PHP

php,xml,curl
I currently send my form data as normal Post. I would like to send it as XML . Current format : name=max Format i need : max Here is my current code : // This is the data to POST to the form. The KEY of the array is the...

How to trigger a ticket on kibanahud from python code

python,curl,elasticsearch,kibana
I am stuck at a problem What I want to do is once a certain threshold is reached I want to trigger a ticket on KibanaHud from my python code. I am creating a json file with all the data that I need for the ticket -> ticket.json I am...

JSON decoding in golang

json,curl,go
So I tried something based on the example here in my code, and get no data, but no error either. The code is: import ( "io" "fmt" "net/http" "encoding/json" ) type Credential struct { username string `json:"username"` password string `json:"password"` } func login(res http.ResponseWriter, req *http.Request) { if req.Method ==...

Symfony2 : Empty $_FILES in controller using curl -F

symfony2,curl
I'm trying to upload a file using curl in command line : curl -v -X PATCH --form "[email protected]/to/my/pngfile.png" http://127.0.0.1:8000/myresource/1 but in my controller when I try to dump, i have nothing : var_dump($request->files); any ideas ? ...

XML Post from form using curl PHP

php,xml,curl
What is the best way to post XML from a form using Curl. I have a HTML Form and i post the data to a new php page and all the fields are collected. How do i collect these fields in XML Format. I can process it from a xml...

Incorrect input parameters when using the Python Requests library

python,bash,curl
I have a Python script using the Requests library that is of this form: uhash = '1234567abcdefg' cookies = { 'uhash':uhash } payload = { 'action':'trade.bump', 'hash':uhash, 'tradeid':'12345678' } r = requests.post( 'http://www.target_url.com/api/core', cookies=cookies, params=payload ) Above is my Python attempt at creating the following cURL request (written with bash):...

incessantly getting null values for reduce function

curl,couchdb
My data is as follows: { "_id": "33d4d945613344f13a3ee929337b1ca8", "_rev": "1-427c691a5c5f504c6b1d885b6b9ff4bc", "release": { "genres": { "genre": "Electronic" }, "identifiers": { "identifier": [ { "description": "Text", "value": "5 021603 054028", "type": "Barcode" }, { "description": "String", "value": 5021603054028, "type": "Barcode" }, { "value": "MAYKING WAP54CD", "type": "Matrix / Runout" } ] },...

file download with curl and php

php,curl,download
I wrote a php function that downloads some (.exe) files using curl extension. The file gets successfully downloaded, but when I try to open it I get not compatible error. I opened it using notepad++ and there I see a '200' added to the beginning of the file. I can't...

execute a script with http requests from xwiki

batch-file,curl,xwiki
I'm searching a simple way to catch informations from a repository like artifactory and put those informations in xwiki page. In xwiki we can execute scripts but I don't know if commands like curl get/put/post can be run from the script.

Got error using curl with github api

javascript,git,curl
I am using the curl to get git repositories information. The command used is: curl https://api.github.com/search/repositories?page=2&q=language:javascript&sort=stars&order=desc However, what I got is: { "message": "Validation Failed", "errors": [ { "resource": "Search", "field": "q", "code": "missing" } ], "documentation_url": "https://developer.github.com/v3/search" } If I type directly the URL in the browser I obtain...

curl won't download empty file

curl
curl -o foo.txt http://test.barrycarter.info/emptyfile.txt curl -O http://test.barrycarter.info/emptyfile.txt I just tried both the above, and neither foo.txt nor emptyfile.txt were created. How can I make curl create them? Knowing that a file (URL) exists and is empty can be useful. In particular, I'm trying to mirror geonames daily updates, and it...

php curl class, Sending Curl request with Content Type json

php,json,curl
I need to send a json post request to a url. I am using php curl class. But my request header is always showing content type as application/x-www-form-urlencoded if even I have set up content type. Here is my code $curl1 = new Curl(); $curl1->setOpt(CURLOPT_RETURNTRANSFER, TRUE); $curl1->setOpt(CURLOPT_HEADER, FALSE); $curl1->setOpt(CURLOPT_POST, TRUE);...

How to escape a JSON variable posted with curl in bash script?

bash,curl,mandrill
I'm submitting a message to Mandrill in a bash script via their API and the content of the 'message' variable is causing the API call to come back with an error: An error occured: {"status":"error","code":-1,"name":"ValidationError","message":"You must specify a key value"} The content of the $message_body variable is: Trigger: Network traffic...

sparql insert with where clause

curl,sparql,4store
How to insert insert query with "where" condition in 4store sparql As far as I have searched I got to know that we have to use curl command for the same.I tried using this Process p = Runtime.getRuntime().exec(new String[]{"bash","-c","curl -i -d 'update=INSERT+DATA+{+?subject2+<http://www.w3.org/2002/07/owl/sameAs>+?subject3+.+}+WHERE+{+?subject2+<http://localhost:2020/vocab/Schema_feature>+\""+first[0]+"\"+.+?subject3+<http://localhost:2020/vocab/Schema_feature>+\""+first[1]+"\"+.+}' http://localhost:8000/update/"});...

post data in an array in php

php,arrays,post,curl
I have collected data and created and array : Array ( [0] => Array ( [id] => 1 [name] => Martin [surname] => test [email] => [email protected] [dob] => 2015-02-24 ) [1] => Array ( [id] => 2 [name] => Kary [surname] => paulman [email] => [email protected] [dob] => 2015-06-26...

How to obtain accurate latitude and longitude of user machine based on IP address

php,curl,geolocation,latitude-longitude
In my PHP based application i would like to capture the location of user machine when user logs in to the webapp based on IP address. I followed this method: $url = "http://freegeoip.net/json/$ip"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $data = curl_exec($ch); curl_close($ch); i...

cURL error: [77] error setting certificate verify locations

php,curl
I use paypal IPN class Quixotix-PHP-PayPal-IPN Now, I get notifcation from paypal to my ipn listener, and i activate the class, but i get the next error: exception 'Exception' with message 'cURL error: [77] error setting certificate verify locations: CAfile: /home/star1231/public_html/cert/api_cert_chain.crt CApath: none' in /home/star1231/public_html/ipn.php:79 Stack trace: #0 /home/star1231/public_html/ipn.php(175): IpnListener->curlPost('cmd=_notify-val...')...

Server-Sent Events Polling causing long delays

javascript,php,jquery,curl,server-sent-events
I have a connector that will call a RESP API using cURL and PHP. I need to call one method every second to check for new messages and then process them. I used the following 2 approaches to handle the messages AJAX Polling using SetInterval(): call the php script once...

defining specific PHP curl options for specific web page retrieval

php,curl
I'm trying to scrape this web page: SiriusXMU to get the "now playing" information. Here's the code I've got so far: $timeout = 60; $url = 'http://www.siriusxm.com/siriusxmu'; $agent= 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0'; $referer = 'http://www.siriusxm.com/channellineup/'; $header[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; $header[] = "Cache-Control: max-age=0"; $header[] = "Connection:...

How to execute POST using CURL

post,curl,asp-classic
How to execute POST using CURL, i have this basic .asp that receives the data via POST and show the result in .JSON format. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% Response.ContentType = "application/json" Response.Write("{ ""responseCode"": " + Request("responseCode") + ", ""publication_id"": " + Request("publication_id") + ", ""version"": " + Request("version") + "}") %>...

php how to send this data threw curl

php,arrays,object,curl
I have to send this data threw curl: -d '{"payer": { "default_payment_instrument":"BANK_ACCOUNT", "allowed_payment_instruments":["BANK_ACCOUNT"], "default_swift":"FIOBCZPP", "contact":{"first_name":"First", "last_name":"Last", "email":"[email protected]" } }, }' How am I supposed to save those data into fields variable? $fields = { "payer": { "default_payment_instrument":"BANK_ACCOUNT", "allowed_payment_instruments":["BANK_ACCOUNT"], "default_swift":"FIOBCZPP", "contact":{"first_name":"First", "last_name":"Last",...

Unzip the archive with more than one entry

linux,curl,zip,pipe,archive
I'm trying to decompress ~8GB .zip file piped from curl command. Everything I have tried is being interrupted at <1GB and returns a message: ... has more than one entry--rest ignored I've tried: funzip, gunzip, gzip -d, zcat, ... also with different arguments - all end up in the above...

data scraping ASPX page with curl [closed]

php,asp.net,perl,curl,screen-scraping
I'm looking for scraping script either php,perl,bash using curl,wget to post request to the webform in the below search page that using aspx and get the result that result contain description for ebook since I'm NOT familiar with .NET so I Having difficulty getting it to work. Here the website...

C# Request - API LiveChat

c#,rest,curl,request
i've been following this Making a cURL call in C# for trying to make a request with the LiveChat API in curl and receive the result on my C# application, the request should be filled as the following as explained in: http://developers.livechatinc.com/rest-api/#!introduction curl "https://api.livechatinc.com/agents" \ -u [email protected]:c14b85863755158d7aa5cc4ba17f61cb \ -H X-API-Version:2...

PHP - Using CURL to authenticate and download a remote File

php,curl
I'm trying to use php to post variables to another php on a remote server and on the file at the remote server I want to read the file and force its download. The file on the remote server is not on a public folder, that's why I need to...

Jenkins job setup automation with SVN credentials

shell,svn,curl,jenkins,credentials
I created a deploy script for a virtual machine (Ubuntu). This script installs SVN, Jenkins, etc, created a job in Jenkins using a curl POST request and an uploaded config.xml (this file contains the job details). But then I couldn't set up the SVN credentials with this script. I only...

Use the Mozilla Backpack Connecti API with PHP

php,json,curl,openbadge
I would like to issue a badge with the Mozilla Backpack Connect API (check this !). To do so, I have followed this document but I still cannot issue a badge ! I have the exact same problem when I just try to get a new access token using the...

Wistia : Uploading file using curl and php

php,curl,wistia
I am trying to upload an mp4 file using curl and php to Wistia video hosting. But i am constantly getting 500 server error in response even though all the parameters seem to be fine. Here is the code where i do a curl call: $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,); curl_setopt($ch,CURLOPT_POST,...

Nutch 2.3 REST curl syntax

rest,curl,nutch
I'm trying to use curl to test out the Nutch 2.X REST API. I'm able to start the nutchserver and inject URLS, but I'm having trouble getting the generate step to work. Here's what I've done: curl -i -X POST -H "Content-Type:application/json" http://localhost:8081/job/create -d '{"crawlId":"crawl-01","type":"INJECT","confId":"default","args":{"seedDir":"/Users/username/myNutchFolder/apache-nutch-2.3/runtime/local/urls/"}}' which when I look at...

Authenticate with login.microsoftonline.com through PHP cURL (SSL connect error)

php,ssl,curl,dynamics-crm-2015
I am trying to extract data from a Micorosft Dynamics CRM 2015 with PHP. From various sources i learned that i had to start with an authentication with login.microsoftonline.com. I am sending an XML request using cURL that results in a SSL connect error. The XML request: <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"...

Update JIRA ticket status using REST API

curl,jira,jira-rest-api,jira-rest-java-api
I am able to create a ticket in JIRA using CURL command and having a json data handy. curl -D- -u : -X POST --data @< filename> -H "Content-Type: application/json" http://< hostname>:< port>/rest/api/2/issue/ I was now trying to update the status of the ticket generated but was getting the following...

(node.js) How to get cookies from remote server?

javascript,node.js,session,curl,cookies
In PHP, getting cookies sent from a remote server is simply a matter of using cURL with some cookie handling option enabled. If I was to treat my server as a client making requests to a remote server, I was wondering how this might be done in node.js? Would my...

Slow CURL CentOS7 with “same” link

curl,dns,centos,hosts
I just installed CentOS7 (3.10.0-229.4.2.el7.x86_64) with nginx (1.8.0). Here my hosts file: [[email protected]_main1 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 127.0.0.1 arm.site.com kpp.site.com w.site.com server.site.com And problem: [[email protected]_main1 ~]# time curl http://arm.site.com/test/fad/site/site?siteId=152 {"OK"} real 0m0.162s user 0m0.003s sys 0m0.003s [[email protected]_main1 ~]# time curl...

curl php response 204 to download zip file

php,curl,remote-server
I need a download a file to remote server. But i can't do it with curl in php. The code is: $ch = curl_init($source); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_BUFFERSIZE, 8096); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); var_dump(curl_exec($ch)); print_r(curl_getinfo($ch)); die; The result is: string(0) "" Array ( [url] => http://example.com/example.zip [content_type]...

Parse.Cloud.httpRequest httpresponse does not match cUrl response

curl,parse.com,bitcoin,chain
I would like to get the same HTTP response from Parse.com cloud code calling Parse.Cloud.httpRequest as I've got from cUrl. But I can't get it. Does anybody know what am I doing wrong? cUrl example: curl https://api.chain.com/v2/bitcoin/transactions/917673efa435b483343ddfe373995df365260c617107d3f9de68abd4e97c981b/confidence?api-key-id=e8d5ed773cf24e31c149ae874eb23c74 response from cUrl: { "transaction_hash":"917673efa435b483343ddfe373995df365260c617107d3f9de68abd4e97c981b",...

How to get all the tags from the tag using PHP DOM?

php,html,dom,curl
I am using PHP's curl for getting webpage data, and for extracting <a> tags from the <body> I am using DOM Document, but it is creating an error. <?php $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => "http://www.google.co.in/?gfe_rd=cr&ei=B5GBVezbDeHA8geU8pfYBw", CURLOPT_RETURNTRANSFER => 1, CURLOPT_USERAGENT => 'Webbot UA' )); $result = curl_exec($ch); curl_close($ch); if...

PHP preg_match not showing results

php,curl,preg-match
I am trying to scrape this page to get the shipping cost for Standard delivery only. It is not showing results. I have tried different techniques for delimiting special characters. Perhaps there would be a better approach to single out the Standard Cost Price. Any suggestions would be helpful.thanks! <?php...

Google Drive API every time asking for authentication code

php,curl,google-drive-sdk
I'm using google drive api to upload a file to google drive using php, but it every time asking me for authentication code fof my application. I have followed the steps given in the URL below https://developers.google.com/drive/web/quickstart/quickstart-php My Code: require_once 'src/Google/autoload.php'; $client = new Google_Client(); // Get your credentials from...

Curl Request with multiple lines

curl
I used Chrome Dev Tools to look at a curl request. When I select 'Copy as cURL', it gave me the following output. How would I make this request be a single line without messing the code up? Would replacing all instances of \r\n with a blank character do the...

Why can't get the length of the iso file with `CURLINFO_CONTENT_LENGTH_DOWNLOAD` in php_curl? [duplicate]

php,curl
This question already has an answer here: PHP: Remote file size without downloading file 9 answers I want to get the length of the iso file on the web http://cdimage.debian.org/debian-cd/8.0.0/i386/iso-cd/debian-8.0.0-i386-lxde-CD-1.iso <?php $szUrl = 'http://cdimage.debian.org/debian-cd/8.0.0/i386/iso-cd/debian-8.0.0-i386-lxde-CD-1.iso'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $szUrl); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_NOBODY, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);...

Converting a basic CURL to Python's request

python,curl,python-requests
The following curl works fine: curl -d '{"date":"2015-05-27T03:48:29.002Z"}' http://blabla.com but I can't get it to work with requests: payload = {'date' : '2015-05-27T03:48:29.002Z'} r = requests.get(url, params=payload, headers=h) what am I doing wrong?...

PHP Multiple cURL requests to REST API stalls

php,rest,cakephp,curl
Currently I have a system that sends multiple requests to a REST API. It is structured something like this: foreach ($data as $d) { $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT_HTTPHEADER, (array of data here)); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec( $ch ); $retry...

Output bash variable with multiple lines to curl json

json,bash,curl,github-api
I'm trying to create a script that will use the Github API to post a comment containing the output of a command. This output has multiple lines. Here's what I'm trying to do: curl -H "Authorization: token oauthtoken" \ -H "Content-Type: application/json" \ -X POST [email protected] \ https://api.github.com/repos/company/repo/issues/14/comments <<EOF {...

json response handling issue

php,json,curl
Hi guys I stuck with retrieving json response below is the json output .I novice in this your help would be highly appreciated. { "productHeader" : { "totalHits" : 684 }, "products" : [ { "name" : "Victoria Hotels", "productImage" : { "url" : "http://hotels.com/hotels/9000000/8640000/8633700/8633672/8633672_20_b.jpg" }, "language" : "en", "description"...

Facebook post to page error

facebook,facebook-graph-api,curl
I am going insane... After Googling, searching here and pulling each of my hairs out one by one, I'm stuck. I am trying to automate posts to a Facebook page and am calling the following: https://graph.facebook.com/oauth/authorize?client_id=XXXXXXXX&scope=publish_actions,publish_pages,manage_pages&redirect_uri=http://www.example.com Followed by: https://graph.facebook.com/oauth/access_token?client_id=XXXXXXX&redirect_uri=http://www.example.com&client_secret=XXXX&code=XXXXXX This successfully gives me the access token, but...

how to keep curl from deleteing log.txt when adding new entry?

bash,curl,logging
I am trying to do: create a bash script that downloads the Ubuntu iso and a file from my own ftp server. Then do a traceroute to my server and save route/date and avg speed of the two downloads to log.txt. Where i am stuck: This seems to do okay...

Sending & (and) sign over cURL with JSON

php,json,curl
I'm sending an array with data over cURL to another server (with PHP). Code before sending: $array = array('title' => "M&M's milk chocolate"); $data = json_encode($array); and code on the other side $data = json_decode($_POST); If there is and (&) sign in array, the $data on other side is empty....

C++ curl POST for LiFx Control

c++,curl,libcurl
I'm using curl with c++ to list all the bulbs successfully curl_easy_setopt(curl,CURLOPT_USERNAME, MY_API_key); curl_easy_setopt(curl, CURLOPT_URL, "https://api.lifx.com/v1beta1/lights/all/"); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &Data); res = curl_easy_perform(curl); To toggle power to all light the documentation http://developer.lifx.com/#toggle-power says to use curl -u...

How to work arround php notice raised incorrecty when posting a string that begins with an @?

php,post,curl,encoding
I want to perform a post request using PHP and Curl. This is how I set my post parameters: curl_setopt($ch,CURLOPT_POSTFIELDS,array('name'=> $name)); When the String in $name happens to contain an @ character at the beginning I get the following error. [8192] curl_setopt(): The usage of the @filename API for file...

How to use curl return value in php script

php,wordpress,curl,login
I have two servers: A where WP is installed on one, and B where it's not. Application run on B is trying to use WP credentials for login. I have a login form on server B: <h1>Login</h1> <div> <form class="forma" id="form" action="login.php" method="POST"> <div class="form-group"> <label>Username</label> <input class="form-control" type="text" name="username"...

Converting curl command to iOS

ios,swift,http,curl
The following curl works curl -G -H "api_key: MYAPIKEY" https://api.semantics3.com/test/v1/products -d 'q={"upc":"70411576937"}' However, upon trying to convert it to iOS I get the following error: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." {NSErrorFailingURLStringKey=https://api.semantics3.com/test/v1/products,...} I have attached my code below but I believe that my problem is the "q=" right...

Program skips NSURLRequest used to download txt file, if placed in IB action with other code

ios,objective-c,curl,nsurl
I am using a NSURL request in objective -c in order to download a webpage and place it in a text file. This is similar to the curl function used in UNIX. Here is the code: NSString *documentDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]; NSString *filePath = [documentDir stringByAppendingPathComponent:@"data.txt"]; NSURLRequest *request...

json_decode is returning a null value instead of an array [on hold]

php,json,curl,error-handling
I am trying to search the keyword email in the decoded data. But it is not able to get the array type from json_decode. Here is the code $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $url, CURLOPT_USERAGENT => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML,...

Filling a std string with memcpy does not set length

c++,curl
I have the following code to fill a std::string with a curl get response. struct curl_string { std::string tmpStr; size_t len; }; void init_string(struct curl_string *s) { s->len = 0; } size_t writefunc(void *ptr, size_t size, size_t nmemb, struct curl_string *s) { size_t new_len = s->len + size*nmemb; s->tmpStr.reserve(new_len +...

Why can't curl download the ffmpeg-2.7.tar.bz2?

curl,ffmpeg
I'm working on OS X Yosemite 10.10.2. I want to use curl command to download the ffmpeg-2.7.tar.bz2 as following: curl -O http://ffmpeg.org/releases/ffmpeg-2.7.tar.bz2 It can't work. However it works fine with other url. The message as following when add the --verbose option: $ curl --verbose -O http://ffmpeg.org/releases/ffmpeg-2.7.tar.bz2 * Hostname was NOT...

mashape sentiment and R integration

r,curl,sentiment-analysis
Here is one mashpe sentiment analysis curl code returning json. How to integrate it with R? curl -X POST --include 'https://community-sentiment.p.mashape.com/text/' \ -H 'X-Mashape-Key: pVke3AAqHzmsh4xNdsKrPshYHQC1p1H78y0jsn2uwaEPcU1TnF' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Accept: application/json' \ -d 'txt=Today is a good day' Edit: Also how can I add -d 'txt=Today is a...

Bash, wget remove comma from output filename

linux,bash,curl,wget
I am reading a file with URL's by line by line then I pass URL to the wget: FILE=/home/img-url.txt while read line; do url=$line wget -N -P /home/img/ $url done < $FILE This works, but some file contains comma in the filename. How I can save the file without the...

cleaning a post URL from an Array

php,post,curl,clean-urls
Here is my code : $query = "SELECT first_name, surname, email FROM app2"; $result = mysql_query($query) or die(mysql_error()); $url = "https://test.com?"; // Where you want to post data while($row = mysql_fetch_array($result)) { $input = ""; foreach($row as $key => $value) $input .= $key . '=' . urlencode($value) . '&'; $input...

Sending file contents from php curl (using post) to c# webapi

c#,php,asp.net,curl,asp.net-web-api
I have to transfer a file object from php to c# webapi. Somehow, in c#, the file contents are coming as Null. This is the partial PHP code after taking out the other stuff <?php $fileContents = file_get_contents($_FILES['fileToUpload']['tmp_name']); $uploadFile = new UploadFile(); //custom object $uploadFile->fileName = "test"; //string $uploadFile->fileContent =...

PHP - Search for item by UPC code in Itemmaster.com

php,curl,upc
This is the api: https://api.itemmaster.com/v2/api but I don't know write the curl code to get the item with UPC: 00040000006039 Where I have to add username and password ?

Compile Curl Visual Studio - unresolved external symbol

c++,curl,static-libraries,unresolved-external
I need to use a static library of libcurl and I found this github rep that generate the libraries. Now, I'm trying to compile a simple piece of code that use curl using the static library, libcurl_a.lib, but without success. At first, I miss the -DCURL_STATICLIB flag and I got...

JavaScript/Node + cURL

javascript,node.js,curl,meteor
I have a line of cURL: curl -X POST --form "[email protected] Harris - Thinking About You (Tez Cadey Remix)_165299184_soundcloud.mp3" https://api.idolondemand.com/1/api/async/recognizespeech/v1 I'm building a hybrid mobile app with Meteor/Ionic as the framework. Therefore, I have access to any Node library that leverages cURL. Can anyone: 1) Suggest one of the many...

CURL IMAP APPEND command

curl,imap
I would like to use CURL in order to APPEND emails at the given date. $ curl -kv -u [email protected]:user 'imap://IP:143' -X 'APPEND INBOX (Mon, 7 Feb > 1994 21:52:25 +0000) {310}' ' Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST) From: Fred Foobar <[email protected]> Subject: afternoon meeting To: [email protected]

PHP - get_headers() return wrong result when non-UTF symbols are in URL

php,curl,http-headers,get-headers
I stumbled upon the wrong result of get_headers() method. URL for testing: http://www.zakon.hr/z/199/Zakon-o-elektroni%C4%8Dkoj-trgovini Here's simple curl request to that URL: As you can see on screenshot there's successful response with 200 OK code. But if I using get_headers() for the same URL I'm getting anothere result: var_dump(get_headers('http://www.zakon.hr/z/199/Zakon-o-elektroničkoj-trgovini')); array(4) { [0]=>...

What certificates does 'curl' use by default?

curl,certificate
What certificates does 'curl' use by default? Example: curl -I -L https://cruises.webjet.com.au fails on Ubuntu 15.04 with curl: (60) SSL certificate problem: unable to get local issuer certificate But when I add the root certificate (see https://www.ssllabs.com/ssltest/analyze.html?d=cruises.webjet.com.au&latest) and run curl -I -L --cacert downlaodedCert.pem https://cruises.webjet.com.au everything is fine. So I...

Updating subscribers in a list using cURL and Mailchimp API v3

php,api,curl,mailchimp
I have this code below that adds a user to a pre-existing list in Mailchimp. $apikey = '<api_key>'; $auth = base64_encode( 'user:'.$apikey ); $data = array( 'apikey' => $apikey, 'email_address' => $email, 'status' => 'subscribed', 'merge_fields' => array( 'FNAME' => $name ) ); $json_data = json_encode($data); $ch = curl_init(); curl_setopt($ch,...

Openstack token, I can get token with curl but can't with urllib

curl,urllib,openstack
[email protected]_PC:~$ curl -D- -H 'X-Storage-User:Lucy' [email protected]_PC:~$ curl -D- -H 'X-Storage-User:Lucy' http://192.168.119.89:8080/auth/v1.0 HTTP/1.1 200 OK X-Storage-Url: http://192.168.119.89:8080/v1/AUTH_Lucy X-Auth-Token: AUTH_tk713d067336d24348bcea1ab220965785 Content-Type: text/html; charset=UTF-8 X-Storage-Token: AUTH_tk713d067336d24348bcea1ab220965785 X-Trans-Id: tx8a03bc278f6d4ab899a25-00557554df Content-Length: 0 Date: Mon, 08 Jun 2015 08:39:59 GMT I can get the X-Storage-token with curl. import urllib,httplib,json from urlparse...

Office 365 unified api Object reference not set to an instance of an object

php,curl,header,office365
I'm trying to use the new office365 unified api to query the users list and user file. I've created the application in azure management portal, and I gave the permission to the new api application (with the directory and files read) I've created both a client and a webapi application,...

Getting a php array

php,api,curl
I need to interpret the array received from a remote licensing. I am calling the remote api via curl and the answer in the browser is: The parsed answer from curl done by using: parse_str(curl_exec($ch), $parsed); print_r($parsed); is exactly as here: Array ( [{"success":true,"uses":154,"purchase":{"id":"GYFt6sW7hbURSVdSpipb5g] => =","created_at":"2015-06-06T16:44:41Z","email":"[email protected]","full_name":"daniel","variants":"","custom_fields":[],"product_name":"Direkt...

Converting fopen to curl using while loop

php,curl,while-loop
Hi all I created a function (PHP) that basically opens a text file with a list of dates each date on it's own line. I then use a while look to go through each line of the file to see if a date listed matches todays or if theres no...

Golang Decode Nested JSON into Nested Struct

json,curl,struct,go,nested
I must be doing something wrong here. I've seen all the stackoverflows and my code doesn't look wrong to me..however, I'm not getting a good decoding of the the nested struct for some reason. Here's a snipit: type Input struct { Value1 string Value2 string Value3 string Value4 string Nest...

Rails 4 Api Users Post test failing

ruby-on-rails,curl,rails-api
I'm building a blog in Rails 4.2 API (for an Angular front end). I'm adding in users with devise (overkill I know), and my controller tests pass for everything. When I try a curl POST request or try to create a user from my Angular app, I get a 406...

PHP Curl Login not working on Heroku

php,curl,heroku
I have a simple php script that make a login to desired webpage. It is working ok on my localhost (wamp server), but when I run it on heroku i get response like this (link: image link:) Script is simple, just like that: <?php $username = "username"; $password = "password";...

getting data with curl failed

php,curl,amazon-web-services
I'm trying to get the data returned from this link with CURL. However, I'm getting false as the output. Here's my code and output: Code: $url = "https://airport.api.aero/airport/distance/LOS/ABV?user_key=MY_USER_KEY_GOES_HERE&units=mile"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); $data = curl_exec($ch); var_dump( curl_getinfo($ch) ); curl_close($ch); var_dump($data); Dump of...

getting and posting html form from https using rcurl

r,curl,rcurl,httr,rvest
i am trying to get and post a form from this https site . user name of the form (RamiLevi), and there is no password. once i get the form i can post it with rvest and get to the html i actually need. GET("https://url.retail.publishedprices.co.il/login") Error in function (type, msg,...

Java CURL request using HTTP

java,curl
I am trying to perform a CURL request using Java. The CURL request is as follows: curl https://apis.sen.se/v2/feeds/N4hSBSpFlYzXT6ZN2IA1KadgSR9rTazv/events/?limit=1 -u username:password I am trying to perform the request as follows: String stringUrl = "https://apis.sen.se/v2/feeds/N4hSBSpFlYzXT6ZN2IA1KadgSR9rTazv/events/?limit=1"; URL url = new URL(stringUrl); URLConnection uc = url.openConnection(); uc.setRequestProperty("X-Requested-With", "Curl"); String userpass = "username" + ":"...

Laravel 5.1 AWS S3 Flysytem: AWS HTTP error: cURL error 6: Couldn't resolve host name

curl,file-upload,amazon-s3,laravel-5,host
I'm on my local environment and are about to enable file uploading to AWS s3, using Laravel 5.1 Flysystem/Filesystem. All setup has been done. I have created a test form, and I'm trying to upload a file. When I push the submit button, I get this absolutely, only too lovable...

returning login status in php [CURL] [closed]

php,wordpress,curl,login
how are you? i have a non expected result , it should return "1" when login successfuly , and "0" when login error, and it always return "0" <?php $username = 'admin'; $password = 'admin'; $loginUrl = 'http://localhost/wordpress/wp-login.php'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $loginUrl); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, 'log='.$username.'&pwd='.$password);...

CORS, Client vs. Server & Rails API GET Request

ruby-on-rails,ruby,api,curl,client
I've built a GET Rails API that checks for an access token and that the registered request.env["HTTP_X_REAL_IP"] matches the IP address that is registered within the admin panel of the app. Example request: https://staging.mysite.com/api/v1/products?access_token=7b9f3cddd3914a6f45fa692997fe6dc9 The API works great when I'm making requests from a server by curling the request or...

python requests with redirection

python,authentication,redirect,curl,python-requests
Trying to authenticate on http://72.ru site, noticed that there were a redirect to https://loginka.ru/auth/. Found that there were 302 POST with plain credentials in data form. Copying headers from Chrome can reproduce that in cURL, but still can't reach in requests module. Warning: page is full of russian letters, registration...

Permission denied Setuptools

python,django,curl,setuptools
I'm trying install setuptools in my Mac, but when I run command curl https://bootstrap.pypa.io/ez_setup.py -o - | python show a message telling: Processing setuptools-17.1.1-py3.4.egg Removing /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/setuptools-17.1.1-py3.4.egg Copying setuptools-17.1.1-py3.4.egg to /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages Adding setuptools 17.1.1 to easy-install.pth file error: [Errno 13] Permission denied:...

Curl class in codeIgniter 3.0

php,codeigniter,curl
I'm a beginner in Codeigniter.I use CI 3.0 (last version).I wanna use recaptch in my code.When I search in google for curl class in codeigniter I find this code $this->load->library('curl'); but when I use this in my code Unable to load the requested class: Curl and reality there isn't this...

Square API Create Item working code now returning an error

php,curl,square-connect
After creating about 1000 inventory items with code, Square suddenly started returning an error. The error returned was: {"type":"bad_request","message":"'name' is required"} Example code: $postData = array( 'id' => 'test_1433281486', 'name' => 'test', 'description' => 'test', 'variations' => array( 'id' => 'test_v1433281486', 'name' => 'Regular', 'price_money' => array( 'currency_code' => 'USD',...

Guzzle ~6.0 multipart and form_params

php,curl,guzzle
I am trying to upload file and send post parameters at the same time like this: $response = $client->post('http://example.com/api', [ 'form_params' => [ 'name' => 'Example name', ], 'multipart' => [ [ 'name' => 'image', 'contents' => fopen('/path/to/image', 'r') ] ] ]); However my form_params fields are ignored and only...

How do I silence the HEAD of a curl request while using the silent flag?

bash,shell,curl,command-line,pipe
When I run the curl command and direct the data to a file, I get back the content of the site as expected. $ curl "www.site.com" > file.txt $ head file.txt Top of site ... However, this command shows a progress bar, which I do not want: % Total %...