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 7009135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:49:27+00:00 2026-05-27T21:49:27+00:00

I am using this file_get_contents for fetching external website html. but it is returning

  • 0

I am using this file_get_contents for fetching external website html. but it is returning different output as compare to live one.

ExternalUrl : http://www.target.com/c/baby-baby-bath-bath-safety/-/N-5xtji#?lnk=nav_t_spc_3_inc_1_1

My live code :
http://apptoplay.com/getImageUrl/file_get_contents.php

code

$url="http://www.target.com/c/baby-baby-bath-bath-safety/-/N-5xtji#?lnk=nav_t_spc_3_inc_1_1";
$html = file_get_contents($url);
    echo $html;

Edit: Differences are in HTML. both are showing different totally different contents.

  • 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-27T21:49:28+00:00Added an answer on May 27, 2026 at 9:49 pm

    you have to tell cURL to accept cookies.

    Try this:

    <?php
    /* STEP 1. let’s create a cookie file */
    $ckfile = tempnam ("/tmp", "CURLCOOKIE");
    
    /* STEP 2. visit the homepage to set the cookie properly */
    $ch = curl_init ("http://www.target.com/");
    curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec ($ch);
    
    /* STEP 3. visit cookiepage.php */
    $ch = curl_init ("http://www.target.com/c/baby-baby-bath-bath-safety/-/N-5xtji#?lnk=nav_t_spc_3_inc_1_1");
    curl_setopt ($ch, CURLOPT_COOKIEFILE, $ckfile);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
    echo $output = curl_exec ($ch);
    ?>
    

    More description

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

Sidebar

Related Questions

I'm using this code to get an int value from 3 different servers: $js
I am using this code to check but not getting result. Here I am
I have a situation. I read in a html page using php using this
I'm using this code: $mysqli = new mysqli(...); $sql = file_get_contents(my_sql_file.sql); $result = $mysqli->multi_query($sql);
I've searched around for solutions to this question, but each one i find, and
Im using this regex to get the contents of a tag in a file.
I am using StyleCop in VS2008. I get this error: SA1638: The file attribute
Using this file as source, I have a situation where I need to retrieve
Using this xslt file found on this blog to pretty print xml using Nokogiri,
I am using this for sending file to user header('Content-type: application/zip'); header('Content-Length: ' .

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.