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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:41:56+00:00 2026-06-14T00:41:56+00:00

I am trying to get an chart image from a remote site. But the

  • 0

I am trying to get an chart image from a remote site.
But the image seemed to be created dynamically from the site when called.
It will return nothing when not logged in.

This is the image URL

<img src="http://fuelbuyer.dtn.com/energy/view/energy/chart.do?width=150&height=120&chartType=0&ts=1352196066175&rackId=446&productId=179&points=8&showExtraLine=True">

I somehow managed to log in using this CODE and tried to display image.
But it is not working.

$ch = curl_init();
$url = 'http://fuelbuyer.dtn.com/energy/common/signin.do?';
$login = 'username=$USER&password=$pass&autoLogin=true&partnerId=0&partnerName=';
curl_setopt($ch, CURLOPT_URL, $url.$login);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch); 

Calling the image URL directly (on browser Addressbar ONLY WHEN LOGGED IN) , will give some code like

”
‰PNG IHDR–xŸ-œGPIDATxÚílÇÇ IHKB-ËuÄØª!Eš°Š !ÈB IÀµ©…œ€ $@S‡8¶ ªÀ”D²œÐbR Æ`˜WjAx;~Äø…ç·ï±;³ýÎk×ûºÙݳ™»Þ_+´Ü÷v÷·3óÿf¾™òqnAa@„ùÂM›6åÔ5}£¡k訚Ži踶¾USž†Nh(_M’5tJC Á™°‚ðN?ÿ¼3>¾=5µîòåêÕô©V¢:‰ê%º+QƒD5õ©Y”›D-Õ*Q›Dí}ê¨S¢.‰º%²Kä蓳­Û¹“߸ÑUPà’ˆ“ˆ—õéôéÓ!rBP¸¡Ÿÿ¼®¨¨F”ïò“”´ÂOŠÐ4?G}=ŽŠ”×ÎgdPòc!† #—[WB}
“

but when called like

<img src="http://fuelbuyer.dtn.com/energy/view/energy/chart.do?width=150&height=120&chartType=0&ts=1352196066175&rackId=446&productId=179&points=8&showExtraLine=True">

will give the correct image.

I really dont know what to do next.

How can I log into the site using cURL and execute this line.
<img src="http://fuelbuyer.dtn.com/energy/view/energy/chart.do?width=150&height=120&chartType=0&ts=1352196066175&rackId=446&productId=179&points=8&showExtraLine=True">
The site will be redirected to the home page when successfully logged in.
So, I have to prevent from redirection too.
The session will be terminated after few seconds.

Thanking you in advance,
Eugine P J

I got it working. Refer this comment.
Unable to fetch my schedule data from my schools site. Login with cURL wont work

  • 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-14T00:41:57+00:00Added an answer on June 14, 2026 at 12:41 am

    The image you received with cURL is correct (see, you get a PNG header).

    If you want to display it on a page of yours – let’s ignore licensing issues here – you need to put your scraping code, above, in a page of its own, e.g. myimage.php.

    Then in your HTML code you put

    <img src="myimage.php" />
    

    and in the myimage.php, once you have $output, you just output it:

    <?php
    $ch  = curl_init();
    $url = 'http://fuelbuyer.dtn.com/energy/common/signin.do?';
    $login = 'username='.$USER.'&password=$pass&autoLogin=true&partnerId=0&partnerName=';
    curl_setopt($ch, CURLOPT_URL, $url.$login);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $output = curl_exec($ch);
    // $info = curl_getinfo($ch);
    curl_close($ch); 
    
    // Let's suppose that $content (what we want to send) is exactly equal to $output
    $content = $output;
    // If, instead, we have in the output something like <img src="crypto-unique.png" />"
    // we will need to parse $output (using XML maybe, or, just this once, a regex)
    // and get its URL, then retrieve the image using cURL again, and *this* will be our
    // final $content.
    
    // Just output
    Header("Content-Type: image/png");
    Header("Content-Length: " . strlen($content));
    die($content);
    
    // Or if we wanted to manipulate it, e.g. send it as JPEG at 75% quality
    $gd = imageCreateFromString($content);
    Header('Content-Type: image/jpeg');
    ImageJPEG($gd, '', 75);
    die();
    
    ?>
    

    For the sordid details of more complicated login schemes, see the answer to How can I scrape website content in PHP from a website that requires a cookie login?

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

Sidebar

Related Questions

I'm trying to get a randomly picked background image (from a selection of 4
I'm trying to create a aspx page that return Image/Png from a chartDirector Here
I'm trying use this code to get image resolution from file bool GetImageSizeEx(const char
I'm trying get the visible portion of UIImage from an UIImageView . UIImageView takes
I am trying to send an image from a Java desktop application to a
Hi All I'm New to Xcode I'm trying to insert image from UITableView to
I am trying to get the textchanged value from textbox to update in my
What i'm trying to do is transfer an image from the web service to
I am trying to track objects inside an image using histogram data from the
I'm trying to get a System.Web.UI.Datavisualization.Chart control to render on my page using ASP

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.