Page 2 of 2

Posted: Tue Jan 17, 2006 5:43 pm
by neoaddict
Would I just put normal headers (eg. header(Something: Something);) or how else would I put it?

Posted: Tue Jan 17, 2006 6:05 pm
by timvw
rtfm and use brain ;)

Where should the headers go to?

http://www.php.net/header : returns http status headers to your visitor

Or do you want to send those headers (with your http request) to the neopets site? :P

Posted: Tue Jan 17, 2006 7:18 pm
by neoaddict
To the Neopets site obviously. :P

Posted: Tue Jan 17, 2006 7:22 pm
by timvw
Well then, show us what you've come up with.

Posted: Tue Jan 17, 2006 8:07 pm
by neoaddict

Code: Select all

<?php

$postfields = array ('username' => 'TEST',
                              'password' => 'TEST',
                              'destination' => 'TEST');

$goodpost = urlencode ($postfields);

$url = 'http://neopets.com/login.phtml?';
$goodurl = urlencode ($url);
                             
$ch = curl_init();

header('Content-Type: application/x-www-form-urlencoded');
header('Referer: http://neopets.com/hi.phtml');

curl_setopt($ch, CURLOPT_URL, $goodurl);
curl_setopt($ch, CURLOPT_POST, true);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $goodpost);

//$something = file_get_contents("http://neopets.com/stockmarket.phtml");
//$something = preg_match("#<marquee>(.*)<\/marquee>#i", $retrievedhtml, $match);

$output = curl_exec($ch);
echo $output;

echo curl_error($ch);

curl_close($ch);

?>

Posted: Wed Jan 18, 2006 12:02 am
by timvw
Not to be harsh, but i don't think you're ready to write a script as the one that you want.
Might want to start with something simpler first.

Posted: Wed Jan 18, 2006 5:45 pm
by neoaddict
Like what?