reading output - help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
arukomp
Forum Contributor
Posts: 113
Joined: Sun Sep 24, 2006 4:22 am

reading output - help

Post by arukomp »

Hello,

I have a problem with reading output of submited page. There is a page which i need to open and read it's output fields:

https://www.e-gold.com/acct/balance.asp ... ase=654321

It's a link to check e-gold balance automaticaly, without need to login. This page has an output field which is named "Gold_Ounces". I need to get it's value. How can i do this?

Thanks for any help
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

The page you're referring to has a CAPTCHA check (Turing Number they're calling it). This is likely preventing your auto-login attempts which is pretty much exactly what it's supposed to do.

I'm straw-grasping your exact objective here...
arukomp
Forum Contributor
Posts: 113
Joined: Sun Sep 24, 2006 4:22 am

Post by arukomp »

Maugrim_The_Reaper wrote:The page you're referring to has a CAPTCHA check (Turing Number they're calling it). This is likely preventing your auto-login attempts which is pretty much exactly what it's supposed to do.

I'm straw-grasping your exact objective here...
No, that link is working and there is no need for turing numbers. Of course this isn't the real link. I can't put my own id and password :)

This is working, it opens balance, but i only need to get it.

There is some info about what fields are there when submiting:

http://www.e-gold.com/docs/e-gold_automation.html

also, there is a perl script. Maybe with that it would be easily to understand hoew to do that, but i don't have any idea about perl language and i don't know how to change it's contents into php language to make it work in php.
Here is that script:

http://www.e-gold.com/unsecure/scripts/balance.txt

I hope someone will know how to do it. There has to be some way to read output of submited page.

Thanks for any help
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

If url wrappers are enabled you can read data via http. The parameter allow_url_fopen in the output of phpinfo() will tell you wether you can use it or not.
According to the perl script you need to send you credentials as POST data. Which version of php do you use?
arukomp
Forum Contributor
Posts: 113
Joined: Sun Sep 24, 2006 4:22 am

Post by arukomp »

PHP Version 4.4.2-pl1
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You can use http://pear.php.net/manual/de/package.h ... client.php to send the credentials and retrieve the data.

Simple example: Sending the POST parameters a and b to http://localhost/yadda.php and displaying the response data

Code: Select all

<?php
require 'HTTP/Client.php';
$c = new HTTP_Client;
$postdata = array(
		'a'=>'1234',
		'b'=>'9876'
	);

$responsecode = $c->post('http://localhost/yadda.php', $postdata);

if ( PEAR::isError($responsecode) ) {
	die('error: '.$responsecode->getMessage());
}
else if ( 200!=$responsecode ) {
	die('http code: '.$responsecode);
}
else {
	$response = $c->currentResponse();
	echo htmlentities($response['body']);
}
?>
Post Reply