Export all books API SSL error #3442

Closed
opened 2026-02-05 06:44:32 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @patsyk1 on GitHub (Jan 11, 2023).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

Hi guys,

Hopefully a super quick one, but I've been looking at testing the php-export-all-books script and keep hitting SSL certificate errors.

I am using WSL to run the scripts from going to my Bookstack deployments (prod & dev both on Ubuntu)

"PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in

PHP Warning: file_get_contents(): Failed to enable crypto in

PHP Warning: failed to open stream: operation failed in"

I am only connecting to my local development Bookstack site so I just want to bypass this rather than going through the adding certificates.

I was able to add a bypass SSL for the node-docs-to-page script, and just wondered if there is something similar for this one.

I've tried a few of the suggested online postings, but to no avail.

Exact BookStack Version

v22.11

Log Content

No response

PHP Version

No response

Hosting Environment

Ubuntu WSL is where scripts are running from.
Ubuntu 20.04 for Bookstack.

Originally created by @patsyk1 on GitHub (Jan 11, 2023). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario Hi guys, Hopefully a super quick one, but I've been looking at testing the **php-export-all-books** script and keep hitting SSL certificate errors. I am using WSL to run the scripts from going to my Bookstack deployments (prod & dev both on Ubuntu) "PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in PHP Warning: file_get_contents(): Failed to enable crypto in PHP Warning: failed to open stream: operation failed in" I am only connecting to my local development Bookstack site so I just want to bypass this rather than going through the adding certificates. I was able to add a bypass SSL for the **node-docs-to-page** script, and just wondered if there is something similar for this one. I've tried a few of the suggested online postings, but to no avail. ### Exact BookStack Version v22.11 ### Log Content _No response_ ### PHP Version _No response_ ### Hosting Environment Ubuntu WSL is where scripts are running from. Ubuntu 20.04 for Bookstack.
OVERLORD added the 🐕 Support label 2026-02-05 06:44:32 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jan 12, 2023):

I was able to add a bypass SSL for the node-docs-to-page script, and just wondered if there is something similar for this one.

👋 I'm assuming you're using this script.

Update this line:

482b7723a9/php-export-all-books/export-books.php (L70)

To this:

$opts = ['http' => ['header' => "Authorization: Token {$clientId}:{$clientSecret}"], 'ssl' => ['verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true]];
@ssddanbrown commented on GitHub (Jan 12, 2023): > I was able to add a bypass SSL for the node-docs-to-page script, and just wondered if there is something similar for this one. :wave: I'm assuming you're using [this script](https://github.com/BookStackApp/api-scripts/blob/main/php-export-all-books/export-books.php). Update this line: https://github.com/BookStackApp/api-scripts/blob/482b7723a9245db4d53fdee7eb09b4f9de83b202/php-export-all-books/export-books.php#L70 To this: ```php $opts = ['http' => ['header' => "Authorization: Token {$clientId}:{$clientSecret}"], 'ssl' => ['verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true]]; ```
Author
Owner

@patsyk1 commented on GitHub (Jan 12, 2023):

Thanks as always for the prompt response @ssddanbrown.

That's let me bypass the cert, however, I have a new issue wherein books with just chapters (and pages underneath those chapters) are exporting as blank.

Is there any way to amend the above script to just grab every page as opposed to every book? I don't so much need/require the organisation to be retained in the exports; more so just to have the actual export of each page.

Many thanks!

@patsyk1 commented on GitHub (Jan 12, 2023): Thanks as always for the prompt response @ssddanbrown. That's let me bypass the cert, however, I have a new issue wherein books with just chapters (and pages underneath those chapters) are exporting as blank. Is there any way to amend the above script to just grab every page as opposed to every book? I don't so much need/require the organisation to be retained in the exports; more so just to have the actual export of each page. Many thanks!
Author
Owner

@ssddanbrown commented on GitHub (Jan 12, 2023):

Huh, strange, I just tested via our demo instance and the book content exported fine in that case.

Is there any way to amend the above script to just grab every page as opposed to every book?

Yeah, the same export endpoints exist for pages, so it'd be a case of replacing api/books references in the script with api/pages. Think everything should otherwise work but not tested myself.

@ssddanbrown commented on GitHub (Jan 12, 2023): Huh, strange, I just tested via our demo instance and the book content exported fine in that case. > Is there any way to amend the above script to just grab every page as opposed to every book? Yeah, the same export endpoints exist for pages, so it'd be a case of replacing `api/books` references in the script with `api/pages`. Think everything should otherwise work but not tested myself.
Author
Owner

@patsyk1 commented on GitHub (Jan 12, 2023):

Thanks @ssddanbrown - changing the api/books references to api/pages has done exactly what I need.

As always, love the product and I look forward to seeing it grow in 2023.

Thanks!

@patsyk1 commented on GitHub (Jan 12, 2023): Thanks @ssddanbrown - changing the `api/books` references to `api/pages` has done exactly what I need. As always, love the product and I look forward to seeing it grow in 2023. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3442