Recently we have moved our website on new server and after that curl requests has stopped working. Our website is on Magento and we are using a plugin which sends request to a webservice using curl.
This code is working on local system and also in old server but on new server curl send the blank response.
I have also print the curl_error output and it is saying "couldn't connect to host". Please let me know if anyone has face this same issue.
is very explicit ... it means Failed to connect() to host or proxy.
The following code would work on any system:
$ch = curl_init("http://google.com"); // initialize curl handle
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
print($data);
If you can not see google page then .. your URL is wrong or you have some firewall or restriction issue.
Related
I'm able to verify the webhook using glitch from the getting started:
https://glitch.com/edit/?fbclid=IwAR2YTjZuGGM9Hi6T_v1eZh_nV6_HY3RYn_8lll4gY1REa_bJy6ZAuq6tkKQ#!/whatsapp-cloud-api-echo-bot
my local server (in a subdomain with https enabled) has the same behavior as glitch and show "WEBHOOK_VERIFIED" on the log for the request:
/webhook?hub.mode=subscribe&hub.verify_token=xpto123&hub.challenge=123
but when try to verify my local server the request from meta does not reach the server.
chrome showing that the connection to the server is secured
After more tests I found that my local server was been blocked by the ISP, understood it after test with another connection.
I made my own server and had tried ngrok and other programs to run it from local host with https redirect but whatsapp doesn't allow the use of those programs.
In the end, my error was that the URL HAS to end in /webhook or else, it won't even send the request. Then it'll send a GET request and you have to return the hub.challenge query param after making sure that the provided token from them is the one you set up. This is my code using NodeJS
if(req.query['hub.verify_token'] === process.env.VERIFY_TOKEN) return res.status(200).send(req.query['hub.challenge'])
I used CloudClare to provide https connection, It points the domain to my server.
When I access through https, the browser says ERR_TOO_MANY_REDIRECTS.
I already set the config as following:
$dbconfigoption['ssl'] = true;
$site_URL = 'https://domain';
What can I do to fix this?
I had the same error a few months ago. It turned out that my vtiger server was getting http and not https requests. It had to do with how the ssl certificate was installed. It was installed on a different server (a router?) on the same network as the vtiger server, which got the request did the decryption and passed it to the vtiger server as an http request. The vtiger server would see an http request and would send a redirect response to the configured https url. When the browser gets the redirect you end up in a redirect loop.
Replace $site_URL with following value
$site_URL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on' ? 'https': 'http')."://".$_SERVER['HTTP_HOST'].(dirname($_SERVER['PHP_SELF']) != '/' && dirname($_SERVER['PHP_SELF']) != '\\' ? str_replace('\\','/',dirname($_SERVER['PHP_SELF'])) : '').'/';
Is there any document available to setup Elasticsearch to serve connection over SSL ?. And is the option available on ELS ?.
Ex : curl -XGET https://localhost:9200/
Thanks.
You can setup your code to call SSL. What language are you using? Are you using a custom client or one provided by ElasticSearch (Find a list of clients supplied by ElasticSearch here)? If you are using a client you can configure them to use SSL (Here is an example for PHP's client).
I use SSL by using PHP's curl library. I do not use an clients, but instead a custom client. The following will list the stats of ElasticSearch from an SSL connection.
<?php
$ch = curl_init('https://localhost:9200/_stats');
curl_exec($ch); // this outputs to the browser.
// You can capture it using PHP's output buffer
// http://php.net/manual/en/function.ob-start.php
curl_close($ch);
As far as I know, SSL traffic cannot be decrypted without the proper certificate.
OK.
But why when I use cURL on PHP, and set it to go through Fiddler proxy on another host:
curl_setopt($ch, CURLOPT_PROXY, "192.168.2.182");
curl_setopt($ch, CURLOPT_PROXYPORT, "8888");
I still can see the created [Tunnels:443] and read HTTPS traffic without installing Fiddler's Certificate on the host running the PHP code.
PHP (linux) <---------------> Fiddler (192.168.2.182) <---------------> (Server:443)
Can someone explain what is happening here?
From the sound of it, you haven't configured curl to validate that the
server (Fiddler) has provided a valid certificate chain.
curl.haxx.se/docs/sslcerts.html - EricLaw
I wish this was posted as an answer.
i am using libcurl to do HTTP request.
The request goes through authenticated proxy.
Below are my settings with regards to proxy
curlResultCode = curl_easy_setopt(curlHandle, CURLOPT_PROXY, <proxy-server>);
curlResultCode = curl_easy_setopt(curlHandle, CURLOPT_PROXYPORT, <port number>);
//curlResultCode = curl_easy_setopt(curlHandle, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
OR
curlResultCode = curl_easy_setopt(curlHandle, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
I cannot give user name and password for the proxy as i expect CURL to intelligently find it like how "winhttp" interface does.
I have tried both ANY and NTLM. However, at times the request goes through successfully through the proxy. At times i am getting "Authentication required: 407" during the easy perform.
Can someone tell me what i have done wrong here to see this random behavior?
Thanks for reading!!!