简体   繁体   English

使用pdfmyurl在受保护的成员区域中将网页转换为pdf

[英]converting web page to pdf in protected members area with pdfmyurl

I'm using the pdfmyurl api to convert web pages to PDF. 我正在使用pdfmyurl api将网页转换为PDF。 This works fine for all pages on my website, which are not in the members area. 这对我网站上所有不在会员区域的页面都适用。 My members area requires a user to log in first. 我的会员区域要求用户首先登录。

According to the documentation ( http://pdfmyurl.com/html-to-pdf-api#secure ) I should be able to pass form fields so their converter can access the page. 根据文档( http://pdfmyurl.com/html-to-pdf-api#secure ),我应该能够传递表单字段,以便其转换器可以访问该页面。 However when I try this, I still get a PDF of the login page. 但是,当我尝试此操作时,仍会获得登录页面的PDF。

My login form ( http://members.mysite.com/login.php ) has the following HTML: 我的登录表单( http://members.mysite.com/login.php )具有以下HTML:

<form class="form-horizontal" id="memberlogin" action="checkpass.php" method="post">
<div class="control-group">
    <label class="control-label" for="user">Username:</label>
    <div class="controls">
        <input name="user" id="user" required>
    </div>
</div>
<div class="control-group">
    <label class="control-label" for="password">Password:</label>
    <div class="controls">
        <input type="password" id="password" name="password" required>
    </div>
</div>
<div class="form-actions">
    <button type="submit" class="btn btn-primary">Sign in</button>
</div>
</form>

And in the checkpass.php script I only check for the values of user and password. 在checkpass.php脚本中,我仅检查用户和密码的值。

I'm using the following API call: 我正在使用以下API调用:

http://pdfmyurl.com/api?license=mylicense&url=http://members.mysite.com/mypage.php&form_url=http://members.site.com/login.php&form_fields[user]=username&form_fields[password]=password http://pdfmyurl.com/api?license=mylicense&url=http://members.mysite.com/mypage.php&form_url=http://members.site.com/login.php&form_fields[user]=username&form_fields[password]=密码

I'm confident the password for the user is correct as I can manually log in. I'm pretty sure this is also how I should pass an array over HTTP GET. 我确信用户的密码正确无误,因为我可以手动登录。我很确定这也是我应该通过HTTP GET传递数组的方式。

Any ideas? 有任何想法吗?

Your form page is http://members.mysite.com/login.php , but you check the login parameters at http://members.site.com/checkpass.php 您的表单页面是http://members.mysite.com/login.php ,但是您在http://members.site.com/checkpass.php上检查了登录参数。

I think PDFmyURL will need to pass the login parameters to http://members.site.com/checkpass.php , because that's where you check them. 我认为PDFmyURL将需要将登录参数传递给http://members.site.com/checkpass.php ,因为您可以在其中检查它们。

Try the following API call to do this 尝试以下API调用来执行此操作

http://pdfmyurl.com/api?license=mylicense&url=http://members.mysite.com/mypage.php&form_url=http://members.site.com/checkpass.php&form_fields[user]=username&form_fields[password]=password

Other than this you must check server logs to find problems with authentication. 除此之外,您必须检查服务器日志以查找身份验证问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM