Curl Post 500 Internal Server Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about curl_init 500 internal server error hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask curl_exec 500 internal server error Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. empty reply from server curl php Join them; it only takes a minute: Sign up Using CURL, gives 500 Internal Server Error up vote 1 down vote favorite I am using CURL and I am getting a 500 internal server error. I am not using
Post 500 Internal Server Error Ajax
the user agent option, could this be causing the issue? This is the snippet $current_url="http://localhost/mysite/entercode.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $current_url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, 'variable1=abc&variable2=123'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); php curl share|improve this question edited Nov 28 '11 at 11:13 JohnP 35.9k777107 asked Nov 28 '11 at 11:10 temp-learn 1992424 1 Check your error logs. Please show us the source of entercode.php - this is where the error lies. –DaveRandom Nov 28 post 500 internal server error angularjs '11 at 11:17 1 Also, you are missing curl_setopt($ch, CURLOPT_POST, 1); –DaveRandom Nov 28 '11 at 11:18 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote accepted entercode.php is throwing an error related to your input. I suggest you check the server error log. Your curl implementation is fine. share|improve this answer answered Nov 28 '11 at 11:12 Steve Rukuts 4,93822752 add a comment| up vote 2 down vote The same thing just happened to me. A 500 Internal Server error when i tried to execute $ch = curl_init();. It turns out php curl wasn't installed on my server. I installed it and presto my code worked! Check this out for how to install PHP CURL share|improve this answer answered Oct 16 '12 at 20:39 AlBeebe 5,25413255 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged php curl or ask your own question. asked 4 years ago viewed 10429 times active 3 years ago Linked 1 How to install PHP/CURL? Related 0Curl error Could not resolve host: saved_report.xml; No
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies ajax post 500 internal server error c# of this site About Us Learn more about Stack Overflow the company
Jquery Post 500 Internal Server Error
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users
Django Post 500 Internal Server Error
Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a http://stackoverflow.com/questions/8294946/using-curl-gives-500-internal-server-error minute: Sign up Curl returns successfully but shows 500 error, Internal server Error up vote 1 down vote favorite I am accessing a web service using curl, but at times I get response but other times it fails with an Internal Server Error even though I actually receive the expected xml file. What could the problem be? $header = array( "Content-type: text/xml;charset=\"utf-8\"", http://stackoverflow.com/questions/29899015/curl-returns-successfully-but-shows-500-error-internal-server-error "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "Content-length: ".strlen($send), ); $URL = 'https:ip:port/xxxxx'; $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($ch, CURLOPT_TIMEOUT, 120); curl_setopt($ch, CURLOPT_URL, $URL ); curl_setopt($ch, CURLOPT_POST, true ); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //array('Content-Type: text/xml')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt($ch, CURLOPT_POSTFIELDS, $send ); //curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); try { $result = curl_exec($ch); curl_close($ch); $f = fopen("./Response.xml", "w"); fwrite($f, $result); fclose($f); } catch (Exception $e) { $payments = "
using curl to access programme pages on BBC's site (to extract track listings) -- have been doing this https://www.sitepoint.com/community/t/internal-error-on-target-site-using-curl-but-not-browser/102574 for a while and all's been well. Now, I get an internal https://liquidplanner.zendesk.com/hc/en-us/community/posts/210588607-Getting-a-500-error-when-creating-a-task-with-PHP error on their site when using curl but not when using my browser. I don't know if this is a programming/server set up mistake on their part or if it's a slightly surreptitious way of blocking curl requests. I'm wondering if anyone with curl installed in their php set 500 internal up could run this code to see if it gives the same or different result as I get please? I'm trying to find out if it's something to do with my server. '; print_r($results); echo ''; ?> I now get: Array ( [FILE] =>
However I am using double quotes, and can't see anything else that could be causing this. Target Url https://app.liquidplanner.com/api/workspaces/120300/tasks Posted String {"task":{"name":"API Task","parent_id":15821159}} The cURL trace is * Adding handle: conn: 0x8eb06b0* Adding handle: send: 0* Adding handle: recv: 0* Curl_addHandleToPipeline: length: 1* - Conn 0 (0x8eb06b0) send_pipe: 1, recv_pipe: 0* About to connect() to app.liquidplanner.com port 443 (#0)* Trying 93.184.219.117...* Connected to app.liquidplanner.com (93.184.219.117) port 443 (#0)* SSL connection using ECDHE-RSA-AES128-GCM-SHA256* Server certificate:* subject: C=US; ST=Washington; L=Seattle; O=LiquidPlanner Inc.; OU=Technology; CN=*.liquidplanner.com* start date: 2014-02-07 00:00:00 GMT* expire date: 2017-02-17 12:00:00 GMT* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.* Server auth using Basic with user '**removed**'> POST /api/workspaces/120300/tasks HTTP/1.1Authorization: Basic **removed**Host: app.liquidplanner.comAccept: */*Accept-Encoding: gzipUser-Agent: KsCogs Curl Handler 1.0content-type: application/jsonContent-Length: 120* upload completely sent off: 120 out of 120 bytes< HTTP/1.1 500 Internal Server Error< Content-Encoding: gzip< Cache-Control: no-cache< Cache-Control: max-age=900< Content-Type: application/json; charset=utf-8< Date: Mon, 30 Jun 2014 12:56:20 GMT< Expires: Mon, 30 Jun 2014 13:11:20 GMT* Server Apache is not blacklisted< Server: Apache< Status: 500 Internal Server Error< Strict-Transport-Security: max-age=31536000< Vary: Accept-Encoding< X-Frame-Options: SAMEORIGIN< X-Rack-Cache: invalidate, pass< X-Request-Id: 3684a601bdbd063a94fed827228082c2< X-UA-Compatible: IE=Edge,chrome=1< Content-Length: 118< * Connection #0 to host app.liquidplanner.com left intact And the response is stdClass Object( [type] => Error [error] => InternalServerError [message] => Internal error; try again and perhaps it will work (no promises).) anyone spot anything obvious? Facebook Twitter LinkedIn Google+ Date Votes 6 comments 0 Jon Snelling July 01, 2014 16:57 Hi Mark, Does a curl command like the one below work? curl -s -u username:password \https://app.liquidplanner.com/api/workspaces/120300/tasks \ -H 'content-type: application/json' \ -X POST \ -d '{"task":{"name":"API Task","parent_