Dynadot โ€” .com Registration $8.99

How to send cookies?

Spaceship Spaceship
Watch
Impact
49
PHP:
<?php
// this must be done somehow how you want
$filename = 'mobile.php';

$handle = fopen("http://us.m.yahoo.com/w/yfinance?.intl=us&.lang=en&t=ms", "rb");

if($handle){
  $somecontent = stream_get_contents($handle);

  $handle = fopen($filename, 'wb');
//  $stringData = "start\n";
  fwrite($handle, $stringData);

  if($handle){
    if (fwrite($handle, $somecontent) === FALSE) {
       echo "Cannot write to file ($filename)";
       exit;
    }
    echo "Success, wrote ($somecontent) to file ($filename)";
//    $stringData = "end\n";
    fwrite($handle, $stringData);
    fclose($handle);
  }else{
     echo "Cannot create file ($filename)";
     exit;
  }
}
chmod($filename, 0777);
?>

This script is used to copy the content of a page (Fallback Widget) then save it to my server as mobile.php file.

When i execute the script above, it printed this message
The website could not set or retrieve your cookies.
The browser may not support cookies or the cookies may be turned off. Please ensure cookies are enabled and retry.

Anyone knows how to send cookies to that website so that we can copy the content of the page?

Thanks.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
It's probably best to use the cURL functions for your purpose. You have more flexibility as you can fake the user agent and set a lot of parameters.
 
0
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back