0: Curl Request Failed
Closed this issue · 14 comments
Chris, I am getting a Curl Request failed using your script. However, am able to get curl working with just about anything else. Even the hutchinson script is working.
It was weird, it only bombed out when I changed servers. Not sure what it might be.
I've created a quick debug branch - can you replace your code with this one - https://github.com/chrisbarr/Beanstalk-PHP-API/blob/curl_debug/lib/beanstalkapi.class.php - and paste in here the output.
It's probably a problem with cURL connecting to https, I might need to tweak a few parameters in the class.
Curl info: Array ( [url] => https://massivecloud.beanstalkapp.com/api/changesets.json?page=1&per_page=15&order_fieldtime&order=DESC [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 224 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.065503 [namelookup_time] => 1.9E-5 [connect_time] => 0.014433 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => 0 [starttransfer_time] => 0 [redirect_time] => 0.065546 [certinfo] => Array ( ) ) Data: bool(false) Error: string(20) "35:SSL connect error"
Yeah, looks like a SSL connect error.
Ok can you grab the latest code from here again - https://github.com/chrisbarr/Beanstalk-PHP-API/blob/curl_debug/lib/beanstalkapi.class.php - and see if that fixes it.
Here is the output.
Curl info: Array ( [url] => https://massivecloud.beanstalkapp.com/api/changesets.json?page=1&per_page=15&order_fieldtime&order=DESC [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 224 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.098558 [namelookup_time] => 1.1E-5 [connect_time] => 0.014547 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => 0 [starttransfer_time] => 0 [redirect_time] => 0.098586 [certinfo] => Array ( ) ) Data: bool(false) Error: string(20) "35:SSL connect error"
Ok fingers crossed for this one...
From here - https://github.com/chrisbarr/Beanstalk-PHP-API/tree/curl_debug/lib - you need to download the cacert.pem file and put it in the /lib folder (along with the class file) and also pull the latest version of beanstalkapi.class.php.
Curl info: Array ( [url] => https://massivecloud.beanstalkapp.com/api/changesets.json?page=1&per_page=15&order_fieldtime&order=DESC [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0 [namelookup_time] => 1.9E-5 [connect_time] => 0.014822 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 [certinfo] => Array ( ) ) Data: bool(false) Error: string(20) "35:SSL connect error" Cert file exists:bool(true)
Also, here is the curl_functions, along with the curl information currently installed...
Array
(
[0] => curl_init
[1] => curl_copy_handle
[2] => curl_version
[3] => curl_setopt
[4] => curl_setopt_array
[5] => curl_exec
[6] => curl_getinfo
[7] => curl_error
[8] => curl_errno
[9] => curl_close
[10] => curl_multi_init
[11] => curl_multi_add_handle
[12] => curl_multi_remove_handle
[13] => curl_multi_select
[14] => curl_multi_exec
[15] => curl_multi_getcontent
[16] => curl_multi_info_read
[17] => curl_multi_close
)
Array
(
[version_number] => 463623
[age] => 3
[features] => 1597
[ssl_version_number] => 0
[version] => 7.19.7
[host] => x86_64-unknown-linux-gnu
[ssl_version] => NSS/3.12.7.0
[libz_version] => 1.2.3
[protocols] => Array
(
[0] => tftp
[1] => ftp
[2] => telnet
[3] => dict
[4] => ldap
[5] => ldaps
[6] => http
[7] => file
[8] => https
[9] => ftps
[10] => scp
[11] => sftp
)
)
Hmmm, I'm running out of ideas now. Do you have access to SSH on this server? Are you certain port 443 is open to allow https connections? The hutchinson script doesn't use https - only http connections (Beanstalk will eventually stop allowing http I believe).
Yeah. Port 443 is open. Let me run a script against another sites https:// domain and get back with you. So odd.
Also, thanks for taking time out of your day to help solve this.
Any luck?
Hey Chris,
Thanks for the code! Saving my life working with BeanStalk. Unfortunately I've begun to hit the same "Curl Request Failed" issue as aidanshealy. I'm getting the error "422: Curl request failed" when trying to use the create_repository() method...simpler methods such as get_account_details() work fine. As a note I am working on localhost, in case that may be an issue.
Damn that's annoying!
Don't think working on localhost would normally be an issue.
Are you using JSON or XML?
It sounds like there's an issue as soon as it executes a PUT or POST command.
I'm on holiday until Tuesday so won't be able to look until then. If you can, try and do some debugging and get the raw response from cURL and Beanstalk and post it here. (Use 'echo curl_error($ch);' and 'var_dump($data);' in _execute_curl() )
Chris
On 14 Jun 2012, at 07:37, hypeunionreply@reply.github.com wrote:
Hey Chris,
Thanks for the code! Saving my life working with BeanStalk. Unfortunately I've begun to hit the same "Curl Request Failed" issue as aidanshealy. I'm getting the error "422: Curl request failed" when trying to use the create_repository() method...simpler methods such as get_account_details() work fine. As a note I am working on localhost, in case that may be an issue.
Reply to this email directly or view it on GitHub:
#29 (comment)
Hey Chris sorry for the delay, am also on vacation, and I really appreciate your time on this especially where you're on vacation. Thanks for letting me know where to look, the problem was on my end and I was able to catch it with var_dump($data). This returned the following error:
string(90) "{"errors":["Repository path seems invalid. You can only use letters, digits and dashes."]}"
Once I removed the spaces in the repo' name, the class worked perfectly. Thansk for the help!
No problem, happy to help. Error handling is something that needs some work so these kinds of problems are a bit more obvious.
Have a good vacation,
Chris
On 17 Jun 2012, at 12:30, hypeunionreply@reply.github.com wrote:
Hey Chris sorry for the delay, am also on vacation, and I really appreciate your time on this especially where you're on vacation. Thanks for letting me know where to look, the problem was on my end and I was able to catch it with var_dump($data). This returned the following error:
string(90) "{"errors":["Repository path seems invalid. You can only use letters, digits and dashes."]}"
Once I removed the dashes, the class worked perfectly. Thansk for the help!
Reply to this email directly or view it on GitHub:
#29 (comment)