Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9190269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:25:23+00:00 2026-06-17T20:25:23+00:00

I am having trouble with this function. It works well with http but doesn’t

  • 0

I am having trouble with this function. It works well with http but doesn’t return anything when using https. I am working on facebook’s url to fetch all public groups post.

function fetchUrl($url)
{
    $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, 20);

     $retData = curl_exec($ch);
     curl_close($ch); 

     return $retData;
}

The only way I’ve seen is to scrape the url by simple php html dom parser and convert it into array. However, I feel there’s a better way, or could make some changes to this existing function. Where am I going wrong?

FYI: I have enabled openSSL in php.ini

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:25:25+00:00Added an answer on June 17, 2026 at 8:25 pm

    Try adding these options

    curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); 
    

    Quoting PHP Manual

    CURLOPT_SSL_VERIFYHOST: 1 to check the existence of a common name in
    the SSL peer certificate. 2 to check the existence of a common name
    and also verify that it matches the hostname provided.

    CURLOPT_SSL_VERIFYPEER: FALSE to stop CURL from verifying the peer’s
    certificate. Alternate certificates to verify against can be specified
    with the CURLOPT_CAINFO option or a certificate directory can be
    specified with the CURLOPT_CAPATH option. CURLOPT_SSL_VERIFYHOST may
    also need to be TRUE or FALSE if CURLOPT_SSL_VERIFYPEER is disabled
    (it defaults to 2).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm having trouble trying to define this function-like macro, which takes 4 vector magnitudes
I am having some trouble wrapping my head around this function: var toStr =
I'm having some trouble decoding & to & within a mail function: This is
Im having some trouble writing a getstring function, this is what I have so
I'm using some jQuery to create a fading rollover effect, but I'm having trouble
I'm having trouble with this js code: $('.downvoted').live('click',function(){ var ele = $(this); var truc
Having trouble framing this assertion in Rspec for my rails app. A User has
Im having trouble understanding this : why Microsoft put Xattribute under Xobject ? they
I am having trouble moving this JLabel across this JPanel? I put the code
I am having trouble with this error message as the line it errors on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.