curl,dns,centos,hosts , Slow CURL CentOS7 with “same” link

Slow CURL CentOS7 with “same” link


Tag: 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   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

And problem:

[[email protected]_main1 ~]# time curl
real    0m0.162s
user    0m0.003s
sys 0m0.003s
[[email protected]_main1 ~]# time curl
real    0m0.011s
user    0m0.002s
sys 0m0.003s

Why can be such big difference? 0m0.162s and 0m0.011s

Here my nsswitch.conf:

passwd:     files sss
shadow:     files sss
group:      files sss

hosts:      files dns myhostname

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files sss

netgroup:   files sss

publickey:  nisplus

automount:  files
aliases:    files nisplus

Just tested it on Fedora Server, and there is no such problems... I dont know what to do...


strace show some timeout

close(3)                                = 0
mmap(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f83f6a0c000
mprotect(0x7f83f6a0c000, 4096, PROT_NONE) = 0
clone(child_stack=0x7f83f720beb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7f83f720c9d0, tls=0x7f83f720c700, child_tidptr=0x7f83f720c9d0) = 8463
poll(0, 0, 150)                         = 0 (Timeout)

And i found that it is bug in curl_7.29.0 . Here link. And Answer


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

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,...

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

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

What certificates does 'curl' use by default?

What certificates does 'curl' use by default? Example: curl -I -L 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 and run curl -I -L --cacert downlaodedCert.pem everything is fine. So I...

json response handling issue

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" : "" }, "language" : "en", "description"...

file download with curl and php

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...

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

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...

sparql insert with where clause

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+<>+?subject3+.+}+WHERE+{+?subject2+<http://localhost:2020/vocab/Schema_feature>+\""+first[0]+"\"+.+?subject3+<http://localhost:2020/vocab/Schema_feature>+\""+first[1]+"\"+.+}' http://localhost:8000/update/"});...

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

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...


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]

Nutch 2.3 REST curl syntax

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...

Compile Curl Visual Studio - unresolved external symbol

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...

Server-Sent Events Polling causing long delays

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...

JavaScript/Node + cURL

I have a line of cURL: curl -X POST --form "[email protected] Harris - Thinking About You (Tez Cadey Remix)_165299184_soundcloud.mp3" 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...

Nginx block access to referring url

I've discovered a domain is pointing to my servers IP address as an A-record. I've tried to implement various measures to have have it blocked. I can block it accessing assets on the server i.e loading JS/CSS files and I can block it when a link is accessed from within...

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

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 execute POST using CURL

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") + "}") %>...

returning login status in php [CURL] [closed]

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);...

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

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 => "", CURLOPT_RETURNTRANSFER => 1, CURLOPT_USERAGENT => 'Webbot UA' )); $result = curl_exec($ch); curl_close($ch); if...

API Integration

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...

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

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,...

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

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 = "$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...

PHP Multiple cURL requests to REST API stalls

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...

Redirect Loop on Heroku with Rails 4 App, but not on local machine

App running Ruby 2.2.2, Rails 4.2.1 When I run my app locally everything is fine. It was running fine on heroku until I made some updates. Now all I get in a browser is "Err too many redirects" from Chrome, or "Too many redirects..." in Safari. Even after I rolled...

curl php response 204 to download zip file

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] => [content_type]...

Understanding curl request

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/...

Slow CURL CentOS7 with “same” link

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 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 And problem: [[email protected]_main1 ~]# time curl {"OK"} real 0m0.162s user 0m0.003s sys 0m0.003s [[email protected]_main1 ~]# time curl...

php how to send this data threw 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",...

Why do we send the length of a string in most of the currently protocols

I wondering why most of the protocols (Like dns for example) write the length of a string before it. For example: 3www6google3com Why did it do this in that way? I can't figure out through searches over the internet....

XML Post from form using curl PHP

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...

defining specific PHP curl options for specific web page retrieval

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 = ''; $agent= 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0'; $referer = ''; $header[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; $header[] = "Cache-Control: max-age=0"; $header[] = "Connection:...

Permission denied Setuptools

I'm trying install setuptools in my Mac, but when I run command curl -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:...

Update JIRA ticket status using REST 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...

Need help checking if to emails are part of the same domain?

Background information: I need to make a system that lets users log in by identifying themselves with an email address/password combination. So I'm trying to find a way to check that the login matches something in the database, when the two may be the same address that's typed differently. So...

Unzip the archive with more than one entry

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...

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

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 It can't work. However it works fine with other url. The message as following when add the --verbose option: $ curl --verbose -O * Hostname was NOT...

incessantly getting null values for reduce function

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" } ] },...

access tomcat deployed application (aws) by domain name (

I am new to aws hosting, please help me out in pointing the domain name to tomcat hosted application. During configuration following steps are taken- 1- I have created ec2 ubuntu instance. Configured with java, tomcat. Deployed my war files on tomcat. I am able to access the application successfully....

CORS, Client vs. Server & Rails API GET Request

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: The API works great when I'm making requests from a server by curling the request or...

PHP - Search for item by UPC code in

This is the 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 ?

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

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...

Rails 4 Api Users Post test failing

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...

What does it mean when a “dig” command with “+nssearch” option returns nothing?

When I run the following dig command on with the +nssearch option I get no results: mac$ dig +nssearch mac$ Can someone explain why no data is returned here? The +nssearch option reads the SOA of all the authoritative name servers I believe. Does this mean there are...

Authenticate with through PHP cURL (SSL connect error)

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 I am sending an XML request using cURL that results in a SSL connect error. The XML request: <s:Envelope xmlns:s="" xmlns:a=""...

How does DNS server know the IP address of an SSL's URL?

The SSL/TLS (https) protocol encrypts both of the web page url and its content. So I'm wondering how could the DNS server know the ip address of the requested url if it is encrypted? Any documented reference or idea?

How to use curl return value in php script

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"...

PHP - Using CURL to authenticate and download a remote File

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...

python requests with redirection

Trying to authenticate on site, noticed that there were a redirect to 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...

JSON decoding in golang

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 ==...

Filling a std string with memcpy does not set length

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 +...