Jump to content

victorianrider

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Everything posted by victorianrider

  1. Thank you very much Worked a treat. I'll bookmark this site, has a lot of resourceful information on it regarding curl. I've searched google for tutorials and haven't had much luck. Thanks again.
  2. Hi, I've been semi-teaching myself curl, and I decided to try logging into Facebook with it. This is what I have so far... <?PHP $Email = strip_tags(str_replace(' ', '', $_POST['email'])); $Password = strip_tags(str_replace(' ', '', $_POST['password'])); $FBlogin = 'https://www.facebook.com/login.php?login_attempt=1'; $MoreData = "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=u2nsf&locale=en_US&email=".urlencode($Email)."&pass=".urlencode($Password)."&default_persistent=0&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=u2nsf"; $Cookie = "cookie.txt"; $fp = fopen($Cookie,'wb'); $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7"; //login to facebook $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$FBlogin); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_COOKIEFILE, $Cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $Cookie); curl_setopt($ch, CURLOPT_REFERER, $FBlogin); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $MoreData); $Excecute = curl_exec($ch); echo $Excecute; ?> Right now I have it echo'ing out to see what's going wrong. I'm getting cookie errors from facebook saying that "I must have cookies enabled". What could be wrong in my script that would trip such an error? Thanks.
  3. I am not stealing it, the app can be run off-site so to speak, I'm simply trying to do it without logging in manually. If you have the application installed, and you are logged into facebook and load up the iframe url the app will load with no problem, so I don't know why this would be defined as doing anything wrong.
  4. Ok, and what exactly do you believe it would be breaking? Thanks.
  5. Hey guys, Been trying to get my head around curl over the past month, I need help with loading one of Facebook's Applications. I need the script to: 1) Log into Facebook. 2) Load up the application. 3) Load up the application's iFrame. I've got steps 1 + 2 down, so it logs into Facebook and loads up the application alright, but when it comes to loading up the specific application's iframe, it re-directs me to log in again. I am 99% sure it's something to do with cookies because if you log in locally and load up the iframe url it has no problem loading up the app. (Iframe URL: http://mobsters-fb-apache-dynamic-lb.playdom.com/prod_facebook/facebook/mobsters_v1/facebook_iframe.php?track=bookmark) Here is my current code: (Running it in apache) And also I am really new to curl and am pretty much learning on the go so please excuse any obvious errors $Email = strip_tags(str_replace(' ', '', $_POST['email'])); $Password = strip_tags(str_replace(' ', '', $_POST['password'])); $MobstersURL = "http://apps.facebook.com/mobstersapp/index.php?track=bookmark&ref=bookmarks&count=0"; $FBlogin = 'https://www.facebook.com/login.php?login_attempt=1'; $Data = 'charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=vuCfh&locale=en_US&email='.urlencode($Email).'&pass='.urlencode($Password).'&default_persistent=0&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&lsd=vuCfh'; $Cookie = "cookie.txt"; $fp = fopen($Cookie,'wb'); $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7"; //login to facebook $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$FBlogin); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_COOKIEFILE, $Cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $Cookie); curl_setopt($ch, CURLOPT_REFERER, $FBlogin); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $Data); $Excecute = curl_exec($ch); //echo $Excecute; //load up mobsters then display it curl_setopt($ch, CURLOPT_URL,$MobstersURL); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_REFERER, "http://www.facebook.com/?ref=logo"); curl_setopt($ch, CURLOPT_COOKIEFILE, $Cookie); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $LoadMobsters = curl_exec($ch); echo $LoadMobsters; //load up mobsters in iframe THIS IS WHERE I'M STUCK curl_setopt($ch, CURLOPT_URL, "http://mobsters-fb-apache-dynamic-lb.playdom.com/prod_facebook/facebook/mobsters_v1/facebook_iframe.php?track=bookmark"); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_COOKIEFILE, $Cookie); curl_setopt($ch, CURLOPT_REFERER, "http://apps.facebook.com/mobstersapp/index.php?track=bookmark&ref=bookmarks&count=0"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 1); $Load_iFrame = curl_exec($ch); echo $Load_iFrame; // This is where I noticed it wasn't working since instead of loading up the iframe, it brought me back to facebook to log in. So yeah I need some help in loading up the iframe since that is where I need to grab important data. Any help would be much appreciated, and yes, I've been to http://php.net/manual/en/book.curl.php a billion times which is why I've come here where the pro's are for help Thanks.
  6. Sorry guys, I'm an idiot, I'm not sure what happened last time I ran the script, but now it seems to be working fine So yeah kind of solved
  7. Hey guys, I have a script that grabs data from a separate .txt file which is used to perform certain actions within a user's account. The data I'm having trouble with is user key which is used to authenticate an http header. An example of what the txt file would hold is this: 360235276 PbI1c5+PGHSshccYd58AklmTgf5u+tbWZplMRYYxFSivRYw4AZhaVNHwADozYZhZhPnXRSV1rmsrhf1td7w6bJbySZmPHLl+hleyz/Ht4iM= 477947328 cXTnFEVP74RWtAgqM5BlwtgW2i9rP/v44oANzwF+yJZ+9mpvaschyo/HaYP1qUXgIK8nK7jy74iSCEHAgpPgPdryzpReM5cbnVDjRw7h9S0= 503724987 XXEJsklZTFaTx8MLjuNIz0S65Sn02rgbHl2sahdReQdadKP39evIXUoYdr5NyQMWDVE7cRpvn+zJ7mteH7WJzVh0U/sOcSG7kfcuaWpAOfo= The format I have is: account_ID user_key New account on a fresh line. So in my script I have it grabbing the data as so: $User_DataFile = "accountdata.txt"; $AccData = file($User_DataFile, FILE_SKIP_EMPTY_LINES); foreach($AccData as $line_num => $line) { $AccData = explode(" ", htmlspecialchars(str_replace(" "," ",$line))); if(stristr($AccData[1], "\n")) $AccData[1] = substr($AccData[1], 0, strlen($AccData[1])-2); $AccountID = $AccData[0]; $UserKey = $AccData[1]; echo "Account ID: ".$AccountID."<br/>User Key: ".$UserKey."<br/><br/>"; I have it set to simply echo out the data for debugging which is where I noticed that any slashes or plus or equal signs were not included. When run in Apache it returns this: Account ID: 360235276 User Key: PbI1c5+PGHSshccYd58AklmTgf5u+tbWZplMRYYxFSivRYw4AZhaVNHwADozYZhZhPnXRSV1rmsrhf1td7w6bJbySZmPHLl+hleyz/Ht4iM Account ID: 477947328 User Key: cXTnFEVP74RWtAgqM5BlwtgW2i9rP/v44oANzwF+yJZ+9mpvaschyo/HaYP1qUXgIK8nK7jy74iSCEHAgpPgPdryzpReM5cbnVDjRw7h9S0 Account ID: 503724987 User Key: XXEJsklZTFaTx8MLjuNIz0S65Sn02rgbHl2sahdReQdadKP39evIXUoYdr5NyQMWDVE7cRpvn+zJ7mteH7WJzVh0U/sOcSG7kfcuaWpAOfo So as you can see by comparison there is no slashes or plus or equal signs present, which is going to be a major problem. Is there any way of getting around this problem? Thanks.
  8. Hmm, I'm not seeing the Mark As Solved button, so I'll just state that it is solved
  9. Hey guys, I have a script that is run once a week to fetch some user info for a large number of accounts. The code I have now writes the info correctly, but I was wondering if there was an easy way to have the accountdata.txt file completely wiped before new updated info is written to it, as opposed to deleting it manually every week. $FileName = "accountdata.txt"; $f=fopen($FileName,"a+"); fwrite($f, $UserKey[$i]." ".$SigKey[$i]."\n"); $f=fclose; I could in theory just open the file and delete everything in it manually, save it and then run this script, but I'm always looking for more ways to make things efficient, and come a time when it's run more than once a week it'd be nice to have all that automated. So in summary, I need it to delete all data (if any) from the accountdata.txt file before it writes anything to it. Thanks.
  10. i was thinking more like: $a=array('id1','id2','id3','id4','id5','id6','id7','id8','id9','id10','id11','id12'); $a_cnt = count($a); $sorted_vals = array() for ($i=0;$i<$a_cnt;$i++) { $sorted_vals[] = $a[$i + 1]; $sorted_vals[] = $a[$i]; } ...but if you have an odd number of values in the array, you'll need to account for that. Yes thank you both, I will save both versions, as of right now it is working. Much appreciated for your time and help
  11. That sounds about right, however I'm having a bit of trouble interpreting your suggestion into an actual script, could you please provide an example? That would be great. Cheers
  12. Alright, so I have 100 user ids which I need sorted in a very specific way. Right now, they're organized in a 1-100 format. Let's think of each ID as ID#1, ID#2, ID#3 etc all the way up to ID#100. I need to code a script to echo them out in the following order: $ID2.'<br/>'; $ID1.'<br/>'; $ID4.'<br/>'; $ID3.'<br/>'; $ID6.'<br/>'; $ID5.'<br/>'; //etc up to $ID100.'<br/>'; $ID99.'<br/>'; Is there any special algorithm or trick with an array to do this? I will attach a file with each ID seperated by a semi-colon. And also here is the script I have right now which echo's them out in order: <?PHP $File = "IDs.txt"; $Login = file($File); $String = file_get_contents($File); $Logins = explode(";", $String); foreach($Logins as $Login) { echo $Login.'<br/>'; } ?> [attachment deleted by admin]
  13. Hey guys, every now and then some of my scripts that consistently access headers seem to fail to open the stream. I'm running about 1-50 of these shell scripts at once, but it doesn't seem to make a difference weather I have 1 or 50 scripts open at once. I was wondering if there was a way to tell PHP: Alright, so it failed to open the http stream, I want you to try again until it works. I just want it to try again until it works, because when it doesn't load certain headers, things go very wrong. Thanks. Here's an example of the code where the problem occurs: $Attack = file_get_contents($MobLink."attack?user_id=".$UserID."&target_id=".$TargetID."&auth_key=".$AuthKey); xml_parse_into_struct($iP=xml_parser_create(), $Attack, $iS, $iX);xml_parser_free($iP); echo "$i :.:.: ".strip_tags($iS[$iX['MESSAGE'][0]]['value'])." :.:.:\n\n";
  14. Hey guys, need help on some addition. foreach($login as $line_num => $line) { $login = explode(" ", htmlspecialchars(str_replace(" "," ",$line))); if(stristr($login[1], "\n")) $login[1] = substr($login[1], 0, strlen($login[1])-2); $account_data[$line_num] = array($login[0], $login[1]); $UserID = $login[0]; $AuthKey = $login[1]; $MobLink = "http://mobsters-fb-apache-dynamic-lb.playdom.com/mob_fb/"; $RefreshStat = file_get_contents($MobLink."refresh_stat_manual?user_id=".$UserID."&auth_key=".$AuthKey); $Cash = explode ("<cash>", $RefreshStat); $Cash = explode ("<", $Cash[1]); $Cash = $Cash[0]; $CashForEcho = "$".number_format($Cash[0]); echo $CashForEcho."<br/>"; echo "<br/><br/>"; } The variable $Cash will be dynamic for each user I put in the $login_file, and I need to add all of those values up. So say I put in 3 users within the $login_file, and the $Cash for user 1 was $3,000, the $cash for user 2 was $6,000 and the $cash for user 3 was $1,000, I want to be able to automatically add them all up, so it would echo '$10,000' at the end. Hope I've explained it for you guys to understand easily enough, if not let me know. Thanks
  15. This may be a stupid question so forgive me if it sounds like a dumb question. I have my own server set up and I was wondering if it was at all possible to have a script running that is hosted on my server, while my PC is off or possibly just without having to load it within my web browser. I have a few scripts I wish to run forever without lagging my old PC. Is there a way to do this? Thanks. P.S All the scripts will be using the file_get_contents function to open HTTP streams, and a few explode functions here and there.
  16. That would work just fine if the user ID and auth key were not dynamic, but there are going to be 1000's of people using this, all of which have unique IDs and auth keys. So this would only work for that 1 account. That's why I need it to work from $_POST['RawHeader']
  17. OR Just paste in any header in here and I will sort it out cause I am just that nice <input type="text" name="RawHeader" /><br/> That's from the index.php page
  18. No, I'm trying to use this $RawHeader var from this page here http://www.hiredgunkillers.com/betamate/index.php Instead of the user manually splitting up their own user_id and auth_key and pasting them into the 2 text boxes, I wanted to make it easier and for them to paste the whole header.
  19. Hi, just began working with the isset function, and having a few problems with the following code. As you can see I'm trying to assign some variables using the explode function. This is the string that is taken from the form on my index page http://mobsters-fb-apache-dynamic-lb.playdom.com/mob_fb/refresh_stat_manual?user_id=100000898907997&auth_key=e5f4a2308d13346b4bf6e8228e9f50636240bf9f&nocache=1290001265332& $RawHeader = str_replace(' ', '', $_POST['RawHeader']); if (isset($RawHeader)) { $UserID = explode('user_id=', $RawHeader); $UserID = explode('&', $UserID[1]); $UserID = $UserID[0]; $AuthKey = explode('auth_key=', $RawHeader); $AuthKey = explode('&nocache=', $AuthKey[1]); $AuthKey = $AuthKey[0]; } I am new to the isset function so I don't really know if there is anything wrong with it, but if I try echo out both $UserID and $AuthKey it returns nothing. Any suggestions or solutions? Thanks
  20. Well I have a script that executes a scan on a system set to run infinitely, and I need it to echo out a message each time it loops through, but I don't want it to echo out the message with the next loop message below it, and the next one below that etc... I've tried using the flush(); function and been messing around with that with no luck. For security reasons I don't want to release any of the processing code, but here is the basic construction of the script: <?PHP ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** $RepeatIt = -1; for($g=1; $g!=$RepeatIt+1; $g++) { ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** $ScanMessage = ":.:.: SCANNING THE HITLIST FOR MOBSTER: ".$MobName." (SCAN #$g) :.:.:"."<br/><br/>"; echo $ScanMessage; ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** } ?> At the moment it's returning: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #1) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #2) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #3) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #4) :.:.: So what I want it to do is just delete the scanning message and replace it with the next scan message so while running this script you would see just the number increment on the same line. Any suggestions? Thanks.
  21. Windows 7, I just need it to play a sound if a certain argument is true. I can do it in apache quite easily with a simple html code, but this script runs a lot better in CLI.
  22. Hi, tried google'ing for an answer but found very little help, so decided to post here. I need a way to play a 2 second wav or mp3 file in a shell script. Is there any way to do this? I was hoping for something as simple as this if possible if ($GetHit == 'true') { $PlaySound; echo "Sound Played\n\n"; } Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.