Page 1 of 1
Looking In A Webpage for String
Posted: Fri Jan 26, 2007 9:09 pm
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
Posted: Fri Jan 26, 2007 9:17 pm
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
Posted: Sat Jan 27, 2007 5:11 am
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.
Posted: Sat Jan 27, 2007 5:42 am
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
Posted: Sat Jan 27, 2007 10:35 am
by t0pP8uZz
do you want me to post the whole script?
Posted: Mon Jan 29, 2007 10:05 am
by t0pP8uZz
Please help
Posted: Mon Jan 29, 2007 10:06 am
by feyd
Posted: Mon Jan 29, 2007 10:29 am
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.
Posted: Mon Jan 29, 2007 11:00 am
by jwalsh
Check out the paypal IPN, it will send you a list of success/fail codes and why things failed.
Posted: Wed Jan 31, 2007 8:09 pm
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!
Posted: Thu Feb 01, 2007 8:58 am
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.