Looking In A Webpage for String

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
t0pP8uZz
Forum Newbie
Posts: 9
Joined: Fri Jan 26, 2007 8:51 pm

Looking In A Webpage for String

Post by t0pP8uZz »

ok for example we will take paypal, or whatever or any forum lets just say paypal cause everyone knows that.

ok when you login to paypal you either login or get a page saying invalid username and password, how do my php script detect when it says invalid im thinking looking in the source for the invalid string?

i have no idea what code to use please help thanks.


so again i want to detect when it has failed to login by anyway possible or using the suggested way above

thanks in advanced
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

I'm not exactly sure what method you're using to access this, but i'm pretty sure that their success and failure pages have different URLs. Maybe you could use $_SERVER['PHP_SELF'] to find what you're looking for
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

$_SERVER['PHP_SELF'] contains the name of the script that you're running on your server, it won't contain the name of a script you're accessing (via fsockopen, curl, whatever).

How you'd do this depends entirely on how you're making PHP log into PayPal. If you're using Curl for example, your curl session will return a page of HTML, you could then use str_pos() to check if a particular string exists. Bear in mind though, Paypal (and lots of other sites) don't like people writing scripts to automate logging in, so they tend to put up barriers. Writing something that's robust enough to carry on working when they change things is hard work.
t0pP8uZz
Forum Newbie
Posts: 9
Joined: Fri Jan 26, 2007 8:51 pm

Post by t0pP8uZz »

Thanks very much for replying

i useing curl to make the cookie ect, th escript was working untill paypal did something to there side

$content = curl_exec ($ch); # This returns HTML

but only 1 little string

any help i appriciated
t0pP8uZz
Forum Newbie
Posts: 9
Joined: Fri Jan 26, 2007 8:51 pm

Post by t0pP8uZz »

do you want me to post the whole script?
t0pP8uZz
Forum Newbie
Posts: 9
Joined: Fri Jan 26, 2007 8:51 pm

Post by t0pP8uZz »

Please help
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

What about this%AC
http://devzone.zend.com/node/view/id/1402

Kinda cool. I just kind of skimmed over it, so it may or may not be helpful to you. I'm too lazy to read the whole thing right now.
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post by jwalsh »

Check out the paypal IPN, it will send you a list of success/fail codes and why things failed.
t0pP8uZz
Forum Newbie
Posts: 9
Joined: Fri Jan 26, 2007 8:51 pm

Post by t0pP8uZz »

thanks all for the replys, jwalsh what do you mean do you have any code or links to help me thanks, much appricated!
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post by jwalsh »

Sure do.

http://www.paypal.com/cgi-bin/webscr?cm ... ro-outside

There's also sample code available in the documentation for it.
Post Reply