Jump to content

skwap

Members
  • Posts

    70
  • Joined

  • Last visited

About skwap

  • Birthday 06/08/1995

Profile Information

  • Gender
    Male
  • Location
    INDIA

skwap's Achievements

Member

Member (2/5)

0

Reputation

  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 ..................... ??
×
×
  • 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.