Jump to content

rtadams89

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rtadams89's Achievements

Member

Member (2/5)

0

Reputation

  1. Ahh, interesting. That does seem to help. Thanks for the help.
  2. I got a bit further using this code: <?php // create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, "https://membership.usarugby.org/PublicRosterRpt.aspx?ReportID=27343&PrinterFriendly=1"); //return the transfer as a string $userAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"; curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // $output contains the output string $output = curl_exec($ch); // close curl resource to free up system resources curl_close($ch); echo $output; ?> I at least get some of the page, but a major chunk (with the info I need) in the middle is missing. I think this is due to the use of JavaScript on the page, but I'm not sure what the javascript is doing, so I don't know where to go from here...
  3. Ultimately, I'm trying to get a list of all the "Individual names" that show up on this page: https://membership.usarugby.org/PublicRosterRpt.aspx?ReportID=27343&PrinterFriendly=1 To get the contents of that page (for later parsing with regex), I first tried to use file_get_contents(), but it seems to return the contents of a "Object Moved" error page. Looking at the source code of the page I am trying to scrap, it looks like it uses JavaScript to submit a form post before the data is shown, I image this is why an error page is returned when I attempt to use file_get_contents(). For my second attempt, I used this function which I found on the PHP.net comments page for file_get_contents(). function http_post ($url, $data) { $data_url = http_build_query ($data); $data_len = strlen ($data_url); return array ('content'=>file_get_contents ($url, false, stream_context_create (array ('http'=>array ('method'=>'POST' , 'header'=>"Connection: close\r\nContent-Length: $data_len\r\n" , 'content'=>$data_url )))) , 'headers'=>$http_response_header ); } It too returned the same error page. I would appreciate some help in getting the page data of the URL above into a PHP variable so that I can process it further.
  4. I have a frameset page, on which I use the following code to dynamically resize the iframe based on the size on the content page in the iframe: <script type="text/javascript"> /*********************************************** * IFrame SSI script II- � Dynamic Drive DHTML code library (http://www.dynamicdrive.com) * Visit DynamicDrive.com for hundreds of original DHTML scripts * This notice must stay intact for legal use ***********************************************/ //Input the IDs of the IFRAMES you wish to dynamically resize to match its content height: //Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none: var iframeids=["forumframe"] //Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended): var iframehide="no" var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1] var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers function resizeCaller() { var dyniframe=new Array() for (i=0; i<iframeids.length; i++){ if (document.getElementById) resizeIframe(iframeids[i]) //reveal iframe for lower end browsers? (see var above): if ((document.all || document.getElementById) && iframehide=="no"){ var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i]) tempobj.style.display="block" } } } function resizeIframe(frameid){ var currentfr=document.getElementById(frameid) if (currentfr && !window.opera){ currentfr.style.display="block" if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax currentfr.height = currentfr.Document.body.scrollHeight; if (currentfr.addEventListener) currentfr.addEventListener("load", readjustIframe, false) else if (currentfr.attachEvent){ currentfr.detachEvent("onload", readjustIframe) // Bug fix line currentfr.attachEvent("onload", readjustIframe) } } } function readjustIframe(loadevt) { var crossevt=(window.event)? event : loadevt var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement if (iframeroot) resizeIframe(iframeroot.id); } function loadintoIframe(iframeid, url){ if (document.getElementById) document.getElementById(iframeid).src=url } if (window.addEventListener) window.addEventListener("load", resizeCaller, false) else if (window.attachEvent) window.attachEvent("onload", resizeCaller) else window.onload=resizeCaller </script> When I try to load a page from outside my domain (say http://google.com), the script throws an error. Why is this, and is there any work around?
  5. The exact code would depend on the format of the image tags in your blog content, but couldn't you just load the blog post into a php variable, and use something like str_replace("<img width = 500", "<img width = 200", $blog_content_var) ? If the imgage tags are not consistant, you could use a regex to find and replace them.
  6. I finally got it working. Very simple once I managed to get the numbers straight in my head.
  7. As part of my web gallery, I have a script which generates thumbnails from uploaded pictures. The uploaded pictures vary in dimensions from portrait to landscape. I want all the thumbnails to be exactly 100 x 66 pixels, and contain no white space or "filler." Additionally, I want to maintain the aspect ratio of the original image. Obviously, this means some cropping will occur with images that don't have a 100/66 aspect ratio. I'm familiar with PHP, but not with the GD library, so I've been looking at example scripts to do this. I've found plenty that will create 100 x 66 thumbnails, but they all seem to either distort the aspect ratio to make the picture fit or include white space to pad the image. I have yet to find one that will properly crop and re size any image I throw at it to produce a thumbnail with as much of the original image as possible, while maintaining the aspect ratio. Can anyone point me to such a script?
  8. I'm trying to create a PHP website that will analyze Windows minidump files. I am using the Microsoft Debugger Tools, and specifically kd.exe, to analyze minidumps. If I'm interacting with the computer PHP/Apache is running on, I can open a command prompt and type: "c:\program files\debugging tools for windows (x86)\kd.exe" -y srv*c:\symbols*http://msdl.microsoft.com/download/symbols -i c:\windows\i386 -z c:\test.dmp This will tell me what file caused the crash recorded in the test.dmp minidump file. I'm trying to run this same command in a PHP web page using: passthru("\"c:\program files\debugging tools for windows (x86)\kd.exe\" -y srv*c:\symbols*http://msdl.microsoft.com/download/symbols -i c:\windows\i386 -z c:\test.dmp") Unfortunately, this causes PHP and the web server to hang. I suspect this happens because kd.exe doesn't automatically quit after running. Instead, it goes to a kd.exe debugger prompt. Any ideas about how to go about getting the output of kd.exe using PHP?
  9. A bunch of my relatives got web cams for Christmas and now ant to be able to sue them to chat with one another. I've tried to instruct them on how to do this using a IM application, but since some use Skype, some use MSN, some user AIM, etc. there is not a convenient way to get them all connected. I have been looking into a website based solution. Basically, I want my family members to go to a web page I host, log in, and be able to view (literally) the other family members who are also logged in. I have found a few Flash based solutions (such as http://www.flashpioneer.com/chat/demo/fpchat2.htm), but they are all expensive. Does anyone know of a free, video chat system I can install on my webspace?
  10. I have the following javascript in the HEAD section of one of my pages <script language="JavaScript"> function emailWindow() { eval( "page = window.open('email.php?id=<?php echo $id; ?>', '<?php rand(); ?>', 'toolbar=0,scrollbars=1," + "location=0,statusbar=0,menubar=0,resizable=0,width=250,height=200');" ); } opener.location = "index.php?month=<?php echo $month ?>&year=<?php echo $year ?>"; window.setTimeout('window.close()', 1000); </script> I then have a body onload event set to call the emailWindow() function. Basically what happens is the original page loads, pops up a new page (using the emailWindow function), then closes the original page. Some pop-up blockers prevent the pop-up page from opening. When this happens, I would like the original page to stay open so the user can click a link to manually open the pop-up page. How would I go about doing this?
  11. When you say reduce what you are sending, do you mean you want to cut down on the actual size (bytes) or the # of variables that have to be passed? If you just want to reduce the number of variables, try putting all the md5 sums in an array. Then you can reference the array and pull out any m5d sum or all of them. I don't think md5($ck1+$ck2+$ck3+$ck4+$ck5); is a very good idea. Manly because this will return a different md5 if the same files are sent, but in a different order. md5($ck1+$ck2+$ck3+$ck4+$ck5) != md5($ck5+$ck4+$ck3+$ck2+$ck1); You could always do something like md5($ck1) + md5($ck2) and have it work for your application, but it's not truly a checksum if you do that.
  12. You could always use <a href="http://yourwebsite.com/images/image.jpg" />
  13. How about phpStylist: http://sourceforge.net/projects/phpstylist/ You can use it from the command line if you have PHP installed on your local machine, or upload the single PHP file to your web server and do everything from a web front end.
  14. Right, but how would I get that to run? If I trigger it with the body onLoad event handler, it will run prematurely, and close the page before the email script runs.
  15. I have the following code: <?php $gzip_off = 1; require($_SERVER['DOCUMENT_ROOT'].'/includes/config.php'); require($_SERVER['DOCUMENT_ROOT'].'/includes/functions.php'); if (($auth_lvl >= 2) && (isset($_GET['id']))) { //Email members on addition of new event. $id = $_GET['id']; mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_db(DB_NAME) or die(mysql_error()); $sql = "SELECT d, m, y, title, text FROM calendar WHERE id=" . $id; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result); $d = $row["d"]; $m = $row["m"]; $y = $row["y"]; $title = $row["title"]; $text = $row["text"]; ob_start(); ?> <html> <head> <title>DO NOT CLOSE</title> </head> <body> <center><b>DO NOT CLOSE THIS WINDOW!</b> <br>E-Mails are being sent to members.</center> <? //Output buffering fix echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; ob_flush(); flush(); $recipients = calendar_mail(); $subject = 'New Event'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: *** <no-reply@***.com>' . "\r\n"; $message = ' <html> <head> <title>New *** Event</title> </head> <body> <p>A new event has been posted on the <a href="http://www.***.com/schedule.php">***.com calendar</a>.</p> <br>Event Title: '.$title.' <br>Event Date: '.$m . "/" . $d . "/" . $y.' <br>Added by: '.$name.' <br>Event Details: '.$text.' <br><br>If you want to stop receiving notices when new events are added, you can change your notification preferences here: <a href="http://www.***.com/user_cp.php">http://www.asurfc.com/user_cp.php</a>. </body> </html> '; mail($recipients, $subject, $message, $headers); echo "<br><center><font color='RED'><b>You may now close this window.</b></font></center></body></html>"; } else { echo "ERROR"; } ?> As you can see, it uses output buffering to alert users that a PHP script is still running (sending emails in this case) and then notifies the user when the script finishes. Is there anyway to cause the window to close automatically when the script finishes?
×
×
  • 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.