Jump to content

skwap

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by skwap

  1. when iam echo $data iam getting the entire site with html contents
  2. After using var_dump($data) Output : string(8337) "
  3. hello friends, i want to copy entire data from a website using preg_match_all function. But many times i tried iam getting only blank arrays Website code : <div class="pad"> <a class='thumb' href='http://www.sitename.com/I-m-Sorry-To-Say-But-That-s-What-Miley-Was-Really-Screaming-187/order/popular'> <img src='http://www.sitename.com/pictures/tb/187.jpg'> <div class='thumbtitle'>I'm Sorry To Say But That's Wh</div> <div class='views'>6960 views</div> </a><a class='thumb' href='http://www.sitename.com/Girl-s-Face-209/order/popular'> <img src='http://www.sitename.com/pictures/tb/209.jpg'> <div class='thumbtitle'>Girls face - On a date vs In r</div> <div class='views'>6592 views</div> </a><a class='thumb' href='http://www.sitename.com/How-Men-And-Women-React-To-A-Surprise-Squirrel-On-The-Road-149/order/popular'> <img src='http://www.sitename.com/pictures/tb/149.jpg'> <div class='thumbtitle'>How Men And Women React To A S</div> <div class='views'>3671 views</div> </a><a class='thumb' href='http://www.sitename.com/Easier-Than-I-Thought-31/order/popular'> <img src='http://www.sitename.com/pictures/tb/31.jpg'> <div class='thumbtitle'>Easier Than I Thought</div> <div class='views'>3579 views</div> </a><a class='thumb' href='http://www.sitename.com/How-To-Dodge-A-Kick-29/order/popular'> <img src='http://www.sitename.com/pictures/tb/29.jpg'> <div class='thumbtitle'>How To Dodge A Kick</div> <div class='views'>3105 views</div> </a><a class='thumb' href='http://www.sitename.com/GAHHWD-DAYUM-658/order/popular'> <img src='http://www.sitename.com/pictures/tb/658.jpg'> <div class='thumbtitle'>GAHHWD DAYUM!</div> <div class='views'>3079 views</div> </a><a class='thumb' href='http://www.sitename.com/White-Girls-Be-Acting-Like-This-In-The-Club-248/order/popular'> <img src='http://www.sitename.com/pictures/tb/248.jpg'> <div class='thumbtitle'>White Girls Be Acting Like Thi</div> <div class='views'>2984 views</div> </a><a class='thumb' href='http://www.sitename.com/How-To-Wake-Up-Like-A-Gangsta-DMX-Approved-214/order/popular'> <img src='http://www.sitename.com/pictures/tb/214.jpg'> <div class='thumbtitle'>How To Wake Up Like A Gangsta(</div> <div class='views'>2969 views</div> </a><a class='thumb' href='http://www.sitename.com/Alien-Abduction-210/order/popular'> <img src='http://www.sitename.com/pictures/tb/210.jpg'> <div class='thumbtitle'>Alien Abduction!</div> <div class='views'>2935 views</div> </a><a class='thumb' href='http://www.sitename.com/My-Humps-125/order/popular'> <img src='http://www.sitename.com/pictures/tb/125.jpg'> <div class='thumbtitle'>My Humps</div> <div class='views'>2828 views</div> </a><a class='thumb' href='http://www.sitename.com/Reasons-Not-To-Date-Online-86/order/popular'> <img src='http://www.sitename.com/pictures/tb/86.jpg'> <div class='thumbtitle'>Reasons Not To Date Online</div> <div class='views'>2827 views</div> </a><a class='thumb' href='http://www.sitename.com/White-People-VS-Black-People-Reaction-To-Magic-128/order/popular'> <img src='http://www.sitename.com/pictures/tb/128.jpg'> <div class='thumbtitle'>White People VS Black People R</div> <div class='views'>2816 views</div> </a><div class="clear"></div> PHP Code i used : <?php $data = file_get_contents("http://www.sitename.com/tag/Funny/order/top/page/1"); $sPattern = '~<div class=\"pad\"><a class=\'thumb\' href=\'(.*)\'><img src=\'(.*)\'><div class=\'thumbtitle\'>(.*)</div></a><div class="clear"></div><div id="pagination">~Ui'; preg_match_all($sPattern,$data,$aMatch); print_r($aMatch); ?> Output iam getting : Array ( [0] => Array ( ) [1] => Array ( ) [2] => Array ( ) [3] => Array ( ) ) I need to get the stared (****) values from the html content of all items <a class='thumb' href='*****'> <img src='*****'> <div class='thumbtitle'>******</div> </a><a class='thumb' href='****'> Thanks In advance
  4. Hello Sir, Iam building a mobile application store. There visitor has to select their device name first. I want to store the device name in their browser for lifetime that will help users to use the store without selecting device every time they visit. Please give me a example to store the details in browser as cookie and also check the device name is available or not Thanks
  5. skwap

    MYSQL Problem

    Dear Coders, Iam facing a problem... I have 3 tables files,platforms,resolutions in my database Resolutions Platforms The table resolutions,platforms may have same file_id.. My aim is to select all the fields from files table using the file_id retrived from resoulutions,platforms table. files must be displayed as distinct because the table platforms,resolutions may retrieve same file_id so it cause to display the files more than one time. I want to display files from files table using the file_id My Current Query (Its not working) $match_resolution = '240x320'; $match_platform = 'Java MIDP 2.1'; SELECT * FROM files,platforms,resolutions WHERE files.id=file_id AND resolutions.resolution = '$match_resolution' AND platforms.platform ='$match_platform' iam getting error : Column 'file_id' in where clause is ambiguous Please help me
  6. I want to convert a unix time stamp to the date format (dd/mm/yy). How can i be possible ?
  7. Please consider this sql query & it is used to select data from sql. $sql = mysql_query("SELECT * FROM `appz` WHERE `cid` = '1' ORDER BY `id` DESC LIMIT 3"); But i want to select all the values under the cid of 2,3,4,5 but my query only select the data which the cid under 1. Anyone can help me to make the changes in my query ?
  8. Guys, i want to display ads after 4 items to be displayed. Iam fetching item using mysql database & iam showing 8 items per page. I used below code but its not working because i used the item id to specify the first number but the items is not listed as correct order <?php // first number $first = $row['id']; // second number $second = 4; //checking if the first number is muliple of second. If true then display ads. If($first % $second == "0") { echo 'ads to display'; } It will work if i list items in correct order. Please let me know correct solution. Thanks in advance !
  9. can you edit my code with it ?? to understand it more ?
  10. In otherwords, it erases the entire contents of the file when you open it. There are other modes that allow writing which do not do this, such as 'r+' or 'a'. That said, there is no 'insert' mode where you can write data to the beginning (or middle) of a file without overwriting the data which is there. If you want to do that you have to read in all the existing data to a variable, truncate the file, write the new data, then re-write the old data. You can append data to the end of a file without having to touch the old data first. Use mode 'a' and then just fwrite the new data to put it at the end. yes you are right. using 'a' mode is the way to point the pointer at the end. But my question is how to do a break line ?? check my code. <?php $handle = fopen("test.txt",'a'); //Writing a new line. $result = fwrite($handle,"My name is sonu"); if($result) { echo "Done"; } else { echo "error"; } fclose($handle); ?> the file test.txt has already a line of text that is "my name is khan" & after executing the above code the text file contain a line like this my name is khanMy name is sonu but i want to make it like this my name is khan My name is sonu How it is possible ??
  11. Refer the php stristr() function to match the string with another string.
  12. Means ? PaulRyan post is beneficial for me ? What do you think ?
  13. i think this method is not beneficial for me because my script was for a mobile site & most of mobile devices are not support java script. Also it will not work in user's browser who disabled java script.
  14. Hello Coders, Iam in a confused situation. I made a php script & in that script i want to check how much time (in seconds) the page is taking to fetch the content from the server. If the time is greater than to i defined time then i want to show a error message to the users. Anybody can give me ideas ..................... ??
  15. Dear Coder Bro, I made a simple php script which copy some files to the server directory through a php loop. It means it will copy some 1000+ files via loop & store into a directory. The script worked fine before some 2 - 3days, Suddenly i saw that script is executing but no files copied to the server's directory. I checked the directory permission & it was 755. I changed the permission to 777 and run the script once again and it worked success... But the problem is the directory permission automatically changes to the old 755. I don't know how it happen. I need to change the directory permission to 777 when i begin to run the script. My Question is. 1.) Why did the directory permission automatically changes to 755. ? 2.) How to solve this problem to avoid the every time directory permission changing behavior ? I Hope expert coder guys will respond soon...!
  16. Sir, i know that we can change the user agent via cURL. i want to know is possible to change ip ?
  17. Friends, I developed a script in php & i tested the script before encoding & its working fine. After i encoded the script through ionCube PHP Encoder & uploaded in my server but the file shows only blank page. Its not executing after encoding. What is the problem ?? How to fix it ?
  18. Friends, suppose iam copying 1 to 100 files using a loop in php & when the copy process reach at 50th file my browser went offline. My doubt is will it copy all 100 files ?? OR it will terminate at 50th file ? if i want to get all files copied if the browser went offline then what i want to do ?? Please clear
  19. not working... actually the source code is <div class="on"> <p>There is a dream car for you. <br> <br>Try the free version of Asphalt 5 and race with the fastest dream cars ever created by some of the most prestigious manufacturers in the world. <br>Everything you’ve ever dreamed of doing behind the wheel is here! <br>Stop dreaming and get in!</p> </div> conside the above is as string & make a pattern
  20. Then what can i do ?? can you please help me
  21. Hello Dear, i want to get the text value (bla bla bla) from the below string. $string = "<div class="on"> <p>bla bla bla</p></div>"; my code is $desc_pattern = '/\<div class=\"on\"><p>(.*)<\/p><\/div>/s'; preg_match($desc_pattern,$string,$new_desc); print_r($new_desc); but its only showing Array ( ) please help me
  22. Hello Coder Guys, I need a small help from you. I want to list all files & directories based on last file modification time of server. I want to list new files as first & old files as last. Consider "files" as the directory name which contains all files & directories. Please make the php code to display all files & directories from "files" directory based on last file modification time of server. Thanks IN Advance !
  23. i have made an delete files script which works for only one directory but not sub directory so i want to delete files of same extention from directory and subdirectory. My current code is <? $dir = 'hmm/'; function scanr($dir){ $arr = glob($dir.'/*.jpg'); foreach($arr as $vv){ //check if $vv is a file if(is_file($vv)){ //if file, get the filename $vx=explode('/',$vv); $file=$vx[count($vx)-1]; // if no extension delete the file unlink($vv); // print the deletion message echo $vv." deleted!<br>";}else{ // if $vv is a dir then scan it again for files scanr($vv); }} } scanr($dir); ?>
  24. i think this is you need to get // today date. $today = date('Y-m-d'); //next tuesday date. $next = date('Y-m-d', strtotime("tuesday")); //query to get the records between today & next tuesday. $sql = "SELECT * FROM `DB_table` WHERE date BETWEEN '$today' AND '$next'";
×
×
  • 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.