Jump to content

killuagdt

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

killuagdt's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am using php 5.3.2 with ISS7. I am currently looking to do get search result from Orbitz. This is what LiveHeader of firefox send me: /App/SubmitQuickSearch?z=24ad&r=h searchType=air&source=advanced&searchTab=&dpHidden=&tripLength=7&searchMethodHidden=find&expandTravelers=false&WebLogicSession=A2B3ADE3E700AE0EBE74527EE28F1475&orbotHotelSearchTypeKey=+&previousBot=&currentBot=&isBot=true&isBasicDataPersistenceOnly=true&isFlex=&flightType=roundtrip&origin=lax&destination=las&startDate=08%2F30%2F10&useStartCal=true&startTimeType=Depart&startTime=Anytime&endDate=08%2F31%2F10&useEndCal=true&endTimeType=Depart&endTime=Anytime&adults=1&seniors=0&youths=0&children=0&infantsWithoutSeat=0&infantsWithSeat=0&Search.x=true&preferencingType=airline&carrier1=&carrier2=&carrier3=&alliance=&cabinClass=Economy when I try to search a flight from Lax to Las on 30 and 31. I try this code to get the result: <?php $url = "http://www.orbitz.com/App/SubmitQuickSearch?z=24ad&r=h"; $ch = curl_init(); curl_setopt($ch,CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, 'searchType=air&source=advanced&searchTab=&dpHidden=&tripLength=7&searchMethodHidden=find&expandTravelers=false&WebLogicSession=A2B3ADE3E700AE0EBE74527EE28F1475&orbotHotelSearchTypeKey=+&previousBot=&currentBot=&isBot=true&isBasicDataPersistenceOnly=true&isFlex=&flightType=roundtrip&origin=lax&destination=las&startDate=08%2F30%2F10&useStartCal=true&startTimeType=Depart&startTime=Anytime&endDate=08%2F31%2F10&useEndCal=true&endTimeType=Depart&endTime=Anytime&adults=1&seniors=0&youths=0&children=0&infantsWithoutSeat=0&infantsWithSeat=0&Search.x=true&preferencingType=airline&carrier1=&carrier2=&carrier3=&alliance=&cabinClass=Economy'); $output = curl_exec($ch); curl_close($ch); echo $output; ?> but I received "We’ve noticed there hasn’t been any activity for a while. Please search again for the latest results." error from Orbitz. I can actually see the directing screen before seeing the error. So could you please help me with this problem? I'd really like to know how Bookingbuddy does this. Thank you very much for your help.
  2. I got the download window to pop up with this code <?php $maxspeed=100; chdir('leakchannel.com/download'); $filename=$_GET['file']; $filelocation=$_GET['file']; echo filesize($filelocation); if (connection_status()!=0) return(false); $extension = strtolower(end(explode('.',$filename))); $contentType = 'application/octet-stream'; header("Cache-Control: public"); header("Content-Transfer-Encoding: binary\n"); header('Content-Type: $contentType'); $contentDisposition = 'attachment'; if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { $fileName= preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1); header("Content-Disposition: $contentDisposition;filename=\"$fileName\""); } else { header("Content-Disposition: $contentDisposition;filename=\"$filename\""); } header("Accept-Ranges: bytes"); $range = 0; $size = filesize($fileLocation); echo $size; //echo $size if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']); str_replace($range, "-", $range); $size2=$size-1; $new_length=$size-$range; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range$size2/$size"); } else { $size2=$size-1; header("Content-Range: bytes 0-$size2/$size"); header("Content-Length: ".$size); } //echo $size; if ($size == 0 ) { die('Zero byte file! Aborting download');} set_magic_quotes_runtime(0); $fp=fopen("$fileLocation","rb"); fseek($fp,$range); while(!feof($fp) and (connection_status()==0)) { set_time_limit(0); print(fread($fp,1024*$maxSpeed)); flush(); ob_flush(); sleep(1); } fclose($fp); ?> but it only transfers 20.1Kb and nothing else. So could you please show me what is wrong with this and how to fix it? Thank you very much.
  3. Thank you for your reply. I did get around the extension problem but the script at awesomephp doesn't work to me . I did find it before but I could not implement it . I did a little tweak to get this code: <?php $maxspeed=100; $filename=$_GET['file']; $filelocation=$_GET['filelocation']; if (connection_status()!=0) return(false); $extension = strtolower(end(explode('.',$fileName))); //echo filesize($filelocation); $contentType = 'application/octet-stream'; header("Cache-Control: public"); header("Content-Transfer-Encoding: binary\n"); header('Content-Type: $contentType'); $contentDisposition = 'attachment'; if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { $fileName= preg_replace('/\./', '%2e', $fileName, substr_count($fileName, '.') - 1); header("Content-Disposition: $contentDisposition; filename=\"$fileName\""); } else { header("Content-Disposition: $contentDisposition; filename=\"$fileName\""); } header("Accept-Ranges: bytes"); $range = 0; $size = filesize($fileLocation); if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']); str_replace($range, "-", $range); $size2=$size-1; $new_length=$size-$range; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range$size2/$size"); } else { $size2=$size-1; header("Content-Range: bytes 0-$size2/$size"); header("Content-Length: ".$size); } //echo $size; if ($size == 0 ) { die('Zero byte file! Aborting download');} set_magic_quotes_runtime(0); $fp=fopen("$fileLocation","rb"); fseek($fp,$range); while(!feof($fp) and (connection_status()==0)) { set_time_limit(0); print(fread($fp,1024*$maxSpeed)); flush(); ob_flush(); sleep(1); } fclose($fp); ?> Zero byte file! Aborting download. when I place an echo, it get the $size correctly at the first echo but the second echo has nothing generated . Could you please help me with this? . Thank you very much:D
  4. I am currently using PHP 5.3.2 on IIS 7 and I am wondering how can I write a download script with resume and speed limit. After looking for a while, I found this script that works on speed limit: <?php $local_file = 'file.zip'; $download_file = 'name.zip'; // set the download rate limit (=> 20,5 kb/s) $download_rate = 20.5; if(file_exists($local_file) && is_file($local_file)) { header('Cache-control: private'); header('Content-Type: application/octet-stream'); header('Content-Length: '.filesize($local_file)); header('Content-Disposition: filename='.$download_file); flush(); $file = fopen($local_file, "r"); while(!feof($file)) { // send the current file part to the browser print fread($file, round($download_rate * 1024)); // flush the content to the browser flush(); // sleep one second sleep(1); } fclose($file);} else { die('Error: The file '.$local_file.' does not exist!'); } ?> Though there is a big problem that the download file comes without extension. For example if the original file is file.ext then the client will receive it as file without any extension. I just want to use octet-stream since I have no interest in streaming or other things, but I really want the client to have the extension also. So could you please tell me what is wrong with the above script, and please show me a way to do resume download. Thank you very much for your help.
  5. I am sorry to double post but somehow I couldn't see the edit button anymore So if the mods look here, please merge my posts and accept my apology. I could get over the php limit but now I am receiving Fast CGI process exceeded configured activity timeout error. So could anyone please show me a way to change the timeout? I am using IIS 7 on Windows 7. PS: fcgiext.ini could not be found in my windows folder, so I think I can not change timeout through changing fcgiext.ini
  6. UPDATE: I have tried the code of FuThar and received good result for small file. But for big file (like over 100Mb), the script stop when the file has just been downloaded for more than 1Mb (maybe due to my slow internet connection, but the script runs for less than 1 minute). There is no error statement instead of Notice: Use of undefined constant __FILE_ - assumed '__FILE_'. So I am looking for help to fix this problem:D. Thank you very much in advance. PS: I have already included set_time_limit(0); ini_set('display_errors',true); at the beginning of the script.
  7. @FuThAr: Thank you very much for your codes. I am currently at work so I could not check them but I will try as soon as possible. But I have a small question, is there any limit for the download like file size? I am new to PHP so could you please be more detailed? . Thank you very much. By the way, after googling for a while, I found that some people use fopen/fsockopen with fgets/fwrite for downloading from server to server. I have paid some time for the documentations but simply could not get the idea and could not understand some examples. So if anyone has time, could you please tell me a way to get file with fopen (as I search, fsockopen seems to be somewhat more difficult)? Is there any advantage of using fopen/fsockopen/curl? Your helps are greatly appreciated.
  8. I am currently using PHP 5.3.2 with IIS 7.5. I have just started learning PHP, and I am wondering how I can make a server to server download through PHP? For example I have a direct link like www.abc.com/folder/123.doc which link directly to the file 123.doc. I want to make my server to download the file above to my server to a directories like: /downloaded/123.doc. So could you please tell me how to do it? Thank you very much for your help.
  9. I am using IIS 7.5.1600.16385. I am wondering how can I limit the download speed of user, and watch the workload of the server. For example I want to provide download speed at maximum of 500Kb with resume supported. And I want to watch how much workload the server is currently enduring. I can code in PHP for speed limit but I do not know how can my script be active when an user uses direct link (or uses resume download from download managers). Could you please tell me how to do these things? Thank you very much for your help.
  10. Unix time really solves my problem easily. Thanks you all very much for your responses
  11. I am using PHP 5.3.2 with Mysql 5.1.47. I am wondering how can I delete MySql's rows after a 60 min? For example I have a table: Table Clientip UserIp Time (default current_timestamp) When an user go to the website, a row would be add (or update) to the table ClientIp. For example : 10.0.0.8 currrenttime I have a cronjob to run a script each minutes but I do not know how to check if an user's time value has exceeded 60 min and delete that user's data using mysql_query. So could you please tell me how to do so? Thank you very much for your help.
  12. I am a newbie and I am working on a website with resume download and speed limit. And I use some PHP scripts to handle the resume and speed. But I do not really know how to active the scripts when the client try to resume the download. For example, if a client use resume download for a file with URL = www.acb.com/123.avi I do not know how to active scripts to handle the request? I use IIS 7 with PHP and MySQL Thank you very much for your help.
×
×
  • 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.