Creating pages from JSON, https problems


I had a set-up (helped by the forum) where I have a JSON file that I would use to create pages. It worked great until I had to move to https. And now it doesn’t work. I figure it’s because I used file_gets_contents.
I’m a PHP noob, so I figure that i should use the cURL or Toolkit? I think? Maybe? I’ve not really delved into the Toolkit, so I’m unsure about where to begin.

Any suggestions would be appreciated.

Below is my current set-up:

if($page->file()) {
	$src = page()->file()->url();
  	  if(r::is('post') && get('good')) {

  		$content = file_get_contents($body);
  		$json = json_decode($content, true);

  		foreach($json['entrants'] as $entrant){
  			$data = array(
  			  'id' => $entrant['ID'],
  			  'winner' => $entrant['Winner'],
  			  'category' => $entrant['Category'],
  			  'entrytype' => $entrant['Entrytype'],
  			  'firstname' => $entrant['Firstname'],
  			  'lastname' => $entrant['Lastname'],
  			  'website' => $entrant['URL'],
  			  'credit1' => $entrant['Credit1'],
  			  'credit2' => $entrant['Credit2'],
  			  'credit3' => $entrant['Credit3'],
  			  'credit4' => $entrant['Credit4'],
  			  'credit5' => $entrant['Credit5'],
  			  'image1' => $entrant['image1'],
  			  'image2' => $entrant['image2'],
  			  'image3' => $entrant['image3'],
  			  'image4' => $entrant['image4'],
  			  'image5' => $entrant['image5'],
  			  'series' => $entrant['series']

  			// you need to add something here, a number or whatever to make this unique, 
  			//as the name alone will probably be repetitive
  			$uid = $entrant['Lastname'] . '-' . $entrant['Firstname'] . '-' . $entrant['ID']; 
  			// the template you want to use for the new pages
  			$template = 'gallery-project';

  			// try to create the pages
  			try {
  			// make sure the page you list in the next line, is it's own separate folder, than where you are keeping this 'create pages' page. 
  				$folder = page()->siblings()->visible()->first();			    	
  				$newPage = $folder->children()->create($uid, $template, $data);
  			  	$success = 'The new pages have been created';

  			  echo 'The new page has been created';
			} catch(Exception $e) {
		  		echo 'Page creation has failed: ' . $e->getMessage();


What error do you get?


I get “file_get_contents(): Failed to enable crypto”


Yes, cURL or the Toolkit. see this post: Get JSON data from external website and parse it to show in HTML