darkdmr Posted February 4, 2007 Share Posted February 4, 2007 I want to get soccer fixtures from a famous bookmaker, so I save them in my database and make my own statistics. Problem is that to get the content of the page, With the normal browser I should go to first page, which sets session ID variable, and only then I can go to the page I want. How can I make it that way with PHP? 2 Curl requests ? And how my script will store the session ID of the first curl execution, to provide them to the second ? I tried that way : $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $siteMainPage); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $store = curl_exec ($ch); curl_setopt($ch, CURLOPT_URL, $siteInnerPage); $content = curl_exec ($ch); curl_close ($ch); echo $content; and it even doesn't print the first page's content ? The curl_error gives me this : SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Also, the site is with https, I hope that is not problem ? Link to comment https://forums.phpfreaks.com/topic/37047-problem-getting-content-of-a-site-with-curl/ Share on other sites More sharing options...
Orio Posted February 4, 2007 Share Posted February 4, 2007 I never handled requests through https, but I dont think there should be a problem. Try this: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $siteMainPage); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_exec ($ch); unset($ch) $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $siteInnerPage); curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); $store = curl_exec ($ch); unset($ch); echo $store; ?> Orio. Link to comment https://forums.phpfreaks.com/topic/37047-problem-getting-content-of-a-site-with-curl/#findComment-176949 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.