简体   繁体   中英

php file_get_contents() not returning data

I have a page that usually uses AJAX to retrieve the cart/basket on the page.

I am trying to pdf the page and send it via email including the basket.

While PDF'ing I simply pass the HTML to the PDF server and the cart is being PDF'd with an empty cart (ie the session is not being recognised)

Next I tried file_get_contents() and the same problem occurred. - empty cart I tried the same with cURL also - empty cart

I have added the session id to the URL ( ?'. session_name() . "=". session_id() ) but this throws an error - "failed to open stream: HTTP request failed!”

It looks like I can get it to work, I just can't get it to recognise the session...

Any ideas?

The PDF server is remote. Unless you're handling session via some common method (for example, by using memcache with some form of session token that you can pass around), the remote server cannot view the user's session on the app server. Does that make sense? Much in the same way that my web-site can't view your session from Google, your PDF server cannot view your session from your application server. You'll need to come up with some other method of securely passing the data to the PDF server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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