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

  • SEARCH
  • Home
  • 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 6331973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:10:25+00:00 2026-05-24T18:10:25+00:00

I used file_get_contents, curl, simple html dom but can not get HTML from this

  • 0

I used file_get_contents, curl, simple html dom but can not get HTML from this url:
http://www.zing.vn/news/xa-hoi/choang-voi-clip-cu-ba-cao-tuoi-nhay-boc-nhu-vu-cong/a124040.html

I don’t know why, but the result is haphazard characters, not HTML code.

  • 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-05-24T18:10:26+00:00Added an answer on May 24, 2026 at 6:10 pm

    You need to set CURLOPT_ENCODING, if empty, curl will handle the encoding itself and that’s exactly what you need 🙂

    I’ve tested the code below and it returns the correct character encoding .

    $url ="http://www.zing.vn/news/xa-hoi/choang-voi-clip-cu-ba-cao-tuoi-nhay-boc-nhu-vu-cong/a124040.html";
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_ENCODING,""); 
    $pagebody=curl_exec ($ch);
    curl_close ($ch);
    
    echo $pagebody;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using PHP I can use file_get_contents or cURL to get a URL. jQuery
I used google API to get address from given GPS coordinates. But this address
can someone help me with this problem? I've used file_get_contents() to get all text
I've used a simple file_get_contents function but that didn't get the actual contents (output)
how can I prevent file_get_contents from creating an empty file when being used as
I've always used cURL for this sort of stuff, but this article got me
I am tried to get the html source of a page located on this
In rhino, I'm used to being able to load javascript libraries from a URL,
I have used file_get_contents() to basically get the source code of a site into
How to read Unicode file in php. I have used file_get_contents() function, but after

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.