cURL is not working anymore giving a 408 error
I have a cURL code which was working before but recently it stopped working and gives a 408 request timeout error. I want to know the reason why it stopped working and how can I fix it.
Here's the code :
$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_HTTPHEADER, $header);
curl_setopt($curlSession, CURLOPT_URL, $actualUrl);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curlSession, CURLOPT_POST, 0);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlSession, CURLOPT_TIMEOUT,1100);
curl_setopt($curlSession, CURLOPT_SSLCERT, $clientcert);
curl_setopt($curlSession, CURLOPT_SSLCERTTYPE, 'PEM');
curl_setopt($curlSession, CURLOPT_SSLKEYTYPE, 'PEM');
curl_setopt($curlSession, CURLOPT_SSLKEY, $keyfile);
curl_setopt($curlSession, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($curlSession, CURLOPT_USERAGENT, $agent);
$data = curl_exec($curlSession);
I tried it with the Postman application and it still works on Postman without any delay.Is there any alternative to cURL that I can use to check this?
php curl
add a comment |
I have a cURL code which was working before but recently it stopped working and gives a 408 request timeout error. I want to know the reason why it stopped working and how can I fix it.
Here's the code :
$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_HTTPHEADER, $header);
curl_setopt($curlSession, CURLOPT_URL, $actualUrl);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curlSession, CURLOPT_POST, 0);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlSession, CURLOPT_TIMEOUT,1100);
curl_setopt($curlSession, CURLOPT_SSLCERT, $clientcert);
curl_setopt($curlSession, CURLOPT_SSLCERTTYPE, 'PEM');
curl_setopt($curlSession, CURLOPT_SSLKEYTYPE, 'PEM');
curl_setopt($curlSession, CURLOPT_SSLKEY, $keyfile);
curl_setopt($curlSession, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($curlSession, CURLOPT_USERAGENT, $agent);
$data = curl_exec($curlSession);
I tried it with the Postman application and it still works on Postman without any delay.Is there any alternative to cURL that I can use to check this?
php curl
Maybe its related to DNS problems on your Server: stackoverflow.com/questions/17814925/…
– Steffen Mächtel
Jan 1 at 9:12
I tried it on 2 different servers and it gives the same result.
– Saeesh Tendulkar
Jan 1 at 10:41
add a comment |
I have a cURL code which was working before but recently it stopped working and gives a 408 request timeout error. I want to know the reason why it stopped working and how can I fix it.
Here's the code :
$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_HTTPHEADER, $header);
curl_setopt($curlSession, CURLOPT_URL, $actualUrl);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curlSession, CURLOPT_POST, 0);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlSession, CURLOPT_TIMEOUT,1100);
curl_setopt($curlSession, CURLOPT_SSLCERT, $clientcert);
curl_setopt($curlSession, CURLOPT_SSLCERTTYPE, 'PEM');
curl_setopt($curlSession, CURLOPT_SSLKEYTYPE, 'PEM');
curl_setopt($curlSession, CURLOPT_SSLKEY, $keyfile);
curl_setopt($curlSession, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($curlSession, CURLOPT_USERAGENT, $agent);
$data = curl_exec($curlSession);
I tried it with the Postman application and it still works on Postman without any delay.Is there any alternative to cURL that I can use to check this?
php curl
I have a cURL code which was working before but recently it stopped working and gives a 408 request timeout error. I want to know the reason why it stopped working and how can I fix it.
Here's the code :
$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_HTTPHEADER, $header);
curl_setopt($curlSession, CURLOPT_URL, $actualUrl);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curlSession, CURLOPT_POST, 0);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlSession, CURLOPT_TIMEOUT,1100);
curl_setopt($curlSession, CURLOPT_SSLCERT, $clientcert);
curl_setopt($curlSession, CURLOPT_SSLCERTTYPE, 'PEM');
curl_setopt($curlSession, CURLOPT_SSLKEYTYPE, 'PEM');
curl_setopt($curlSession, CURLOPT_SSLKEY, $keyfile);
curl_setopt($curlSession, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($curlSession, CURLOPT_USERAGENT, $agent);
$data = curl_exec($curlSession);
I tried it with the Postman application and it still works on Postman without any delay.Is there any alternative to cURL that I can use to check this?
php curl
php curl
edited Jan 1 at 11:21
Saeesh Tendulkar
asked Jan 1 at 7:51
Saeesh TendulkarSaeesh Tendulkar
579
579
Maybe its related to DNS problems on your Server: stackoverflow.com/questions/17814925/…
– Steffen Mächtel
Jan 1 at 9:12
I tried it on 2 different servers and it gives the same result.
– Saeesh Tendulkar
Jan 1 at 10:41
add a comment |
Maybe its related to DNS problems on your Server: stackoverflow.com/questions/17814925/…
– Steffen Mächtel
Jan 1 at 9:12
I tried it on 2 different servers and it gives the same result.
– Saeesh Tendulkar
Jan 1 at 10:41
Maybe its related to DNS problems on your Server: stackoverflow.com/questions/17814925/…
– Steffen Mächtel
Jan 1 at 9:12
Maybe its related to DNS problems on your Server: stackoverflow.com/questions/17814925/…
– Steffen Mächtel
Jan 1 at 9:12
I tried it on 2 different servers and it gives the same result.
– Saeesh Tendulkar
Jan 1 at 10:41
I tried it on 2 different servers and it gives the same result.
– Saeesh Tendulkar
Jan 1 at 10:41
add a comment |
1 Answer
1
active
oldest
votes
The 408 Request Timeout error is an HTTP status code that means the request you sent to the website server (e.g. a request to load a web page) took longer than the website's server was prepared to wait. In other words, your connection with the website "timed out."
You can test your API with postman first to see whether it is working fine.
Is your api return large amount of data or your remote server is slow resulting a long request-response time?
See documentation: http://www.php.net/manual/en/function.curl-setopt.php
CURLOPT_CONNECTTIMEOUT - The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.
URLOPT_TIMEOUT - The maximum number of seconds to allow cURL functions to execute.
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 400); //timeout in seconds
also don't forget to enlarge time execution of php script if needed.
set_time_limit(0);
Yeah. I'm sorry I forgot to mention that. I tried it with Postman and it works. The data isn't so large and it used to work before. I just wanted to know why it stopped.
– Saeesh Tendulkar
Jan 1 at 8:41
I tried it with 1000 timeout. Is there any alternative to cURL in php that I can check with.
– Saeesh Tendulkar
Jan 1 at 8:50
can you test the api from server using terminal or any other tools.When your working stable software suddenly stop working, more often it is not an issue in your code rather than server side or network issue.Also for an alternative of CURL you can see this post.
– Tanvir
Jan 2 at 6:25
That's what I want to know. What is the server or network issue that happened suddenly, so I can fix it.
– Saeesh Tendulkar
Jan 2 at 6:28
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993874%2fcurl-is-not-working-anymore-giving-a-408-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The 408 Request Timeout error is an HTTP status code that means the request you sent to the website server (e.g. a request to load a web page) took longer than the website's server was prepared to wait. In other words, your connection with the website "timed out."
You can test your API with postman first to see whether it is working fine.
Is your api return large amount of data or your remote server is slow resulting a long request-response time?
See documentation: http://www.php.net/manual/en/function.curl-setopt.php
CURLOPT_CONNECTTIMEOUT - The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.
URLOPT_TIMEOUT - The maximum number of seconds to allow cURL functions to execute.
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 400); //timeout in seconds
also don't forget to enlarge time execution of php script if needed.
set_time_limit(0);
Yeah. I'm sorry I forgot to mention that. I tried it with Postman and it works. The data isn't so large and it used to work before. I just wanted to know why it stopped.
– Saeesh Tendulkar
Jan 1 at 8:41
I tried it with 1000 timeout. Is there any alternative to cURL in php that I can check with.
– Saeesh Tendulkar
Jan 1 at 8:50
can you test the api from server using terminal or any other tools.When your working stable software suddenly stop working, more often it is not an issue in your code rather than server side or network issue.Also for an alternative of CURL you can see this post.
– Tanvir
Jan 2 at 6:25
That's what I want to know. What is the server or network issue that happened suddenly, so I can fix it.
– Saeesh Tendulkar
Jan 2 at 6:28
add a comment |
The 408 Request Timeout error is an HTTP status code that means the request you sent to the website server (e.g. a request to load a web page) took longer than the website's server was prepared to wait. In other words, your connection with the website "timed out."
You can test your API with postman first to see whether it is working fine.
Is your api return large amount of data or your remote server is slow resulting a long request-response time?
See documentation: http://www.php.net/manual/en/function.curl-setopt.php
CURLOPT_CONNECTTIMEOUT - The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.
URLOPT_TIMEOUT - The maximum number of seconds to allow cURL functions to execute.
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 400); //timeout in seconds
also don't forget to enlarge time execution of php script if needed.
set_time_limit(0);
Yeah. I'm sorry I forgot to mention that. I tried it with Postman and it works. The data isn't so large and it used to work before. I just wanted to know why it stopped.
– Saeesh Tendulkar
Jan 1 at 8:41
I tried it with 1000 timeout. Is there any alternative to cURL in php that I can check with.
– Saeesh Tendulkar
Jan 1 at 8:50
can you test the api from server using terminal or any other tools.When your working stable software suddenly stop working, more often it is not an issue in your code rather than server side or network issue.Also for an alternative of CURL you can see this post.
– Tanvir
Jan 2 at 6:25
That's what I want to know. What is the server or network issue that happened suddenly, so I can fix it.
– Saeesh Tendulkar
Jan 2 at 6:28
add a comment |
The 408 Request Timeout error is an HTTP status code that means the request you sent to the website server (e.g. a request to load a web page) took longer than the website's server was prepared to wait. In other words, your connection with the website "timed out."
You can test your API with postman first to see whether it is working fine.
Is your api return large amount of data or your remote server is slow resulting a long request-response time?
See documentation: http://www.php.net/manual/en/function.curl-setopt.php
CURLOPT_CONNECTTIMEOUT - The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.
URLOPT_TIMEOUT - The maximum number of seconds to allow cURL functions to execute.
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 400); //timeout in seconds
also don't forget to enlarge time execution of php script if needed.
set_time_limit(0);
The 408 Request Timeout error is an HTTP status code that means the request you sent to the website server (e.g. a request to load a web page) took longer than the website's server was prepared to wait. In other words, your connection with the website "timed out."
You can test your API with postman first to see whether it is working fine.
Is your api return large amount of data or your remote server is slow resulting a long request-response time?
See documentation: http://www.php.net/manual/en/function.curl-setopt.php
CURLOPT_CONNECTTIMEOUT - The number of seconds to wait while trying to connect. Use 0 to wait indefinitely.
URLOPT_TIMEOUT - The maximum number of seconds to allow cURL functions to execute.
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 400); //timeout in seconds
also don't forget to enlarge time execution of php script if needed.
set_time_limit(0);
edited Jan 2 at 6:13
answered Jan 1 at 8:05
TanvirTanvir
564
564
Yeah. I'm sorry I forgot to mention that. I tried it with Postman and it works. The data isn't so large and it used to work before. I just wanted to know why it stopped.
– Saeesh Tendulkar
Jan 1 at 8:41
I tried it with 1000 timeout. Is there any alternative to cURL in php that I can check with.
– Saeesh Tendulkar
Jan 1 at 8:50
can you test the api from server using terminal or any other tools.When your working stable software suddenly stop working, more often it is not an issue in your code rather than server side or network issue.Also for an alternative of CURL you can see this post.
– Tanvir
Jan 2 at 6:25
That's what I want to know. What is the server or network issue that happened suddenly, so I can fix it.
– Saeesh Tendulkar
Jan 2 at 6:28
add a comment |
Yeah. I'm sorry I forgot to mention that. I tried it with Postman and it works. The data isn't so large and it used to work before. I just wanted to know why it stopped.
– Saeesh Tendulkar
Jan 1 at 8:41
I tried it with 1000 timeout. Is there any alternative to cURL in php that I can check with.
– Saeesh Tendulkar
Jan 1 at 8:50
can you test the api from server using terminal or any other tools.When your working stable software suddenly stop working, more often it is not an issue in your code rather than server side or network issue.Also for an alternative of CURL you can see this post.
– Tanvir
Jan 2 at 6:25
That's what I want to know. What is the server or network issue that happened suddenly, so I can fix it.
– Saeesh Tendulkar
Jan 2 at 6:28
Yeah. I'm sorry I forgot to mention that. I tried it with Postman and it works. The data isn't so large and it used to work before. I just wanted to know why it stopped.
– Saeesh Tendulkar
Jan 1 at 8:41
Yeah. I'm sorry I forgot to mention that. I tried it with Postman and it works. The data isn't so large and it used to work before. I just wanted to know why it stopped.
– Saeesh Tendulkar
Jan 1 at 8:41
I tried it with 1000 timeout. Is there any alternative to cURL in php that I can check with.
– Saeesh Tendulkar
Jan 1 at 8:50
I tried it with 1000 timeout. Is there any alternative to cURL in php that I can check with.
– Saeesh Tendulkar
Jan 1 at 8:50
can you test the api from server using terminal or any other tools.When your working stable software suddenly stop working, more often it is not an issue in your code rather than server side or network issue.Also for an alternative of CURL you can see this post.
– Tanvir
Jan 2 at 6:25
can you test the api from server using terminal or any other tools.When your working stable software suddenly stop working, more often it is not an issue in your code rather than server side or network issue.Also for an alternative of CURL you can see this post.
– Tanvir
Jan 2 at 6:25
That's what I want to know. What is the server or network issue that happened suddenly, so I can fix it.
– Saeesh Tendulkar
Jan 2 at 6:28
That's what I want to know. What is the server or network issue that happened suddenly, so I can fix it.
– Saeesh Tendulkar
Jan 2 at 6:28
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993874%2fcurl-is-not-working-anymore-giving-a-408-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Maybe its related to DNS problems on your Server: stackoverflow.com/questions/17814925/…
– Steffen Mächtel
Jan 1 at 9:12
I tried it on 2 different servers and it gives the same result.
– Saeesh Tendulkar
Jan 1 at 10:41