Jump to content

vin_akleh

Members
  • Posts

    36
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

vin_akleh's Achievements

Member

Member (2/5)

0

Reputation

  1. how can i do this? select * From table_name Where date = currentmonth when date is a double and i insert it like so date = date("U") so i want to select the month of date("U") for the current month
  2. i can match this pattern /<a href="\/How_I_Met_Your_Mother\/season-1\/episode-1\/search\?page=\d+".+\d+<\/a>/i but my priblem is that this pattern selects line by line into an array what i need it to do is that it selects every match in 1 single line and puts it in a array with different index. $html=<div class="pagination"><span class="disabled prev_page">« Previous</span> <span class="current">1</span> <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2" rel="next">2</a> <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=3">3</a> <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=4">4</a> <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2" class="next_page" rel="next">Next »</a></div> //*this is all in one line not multiple lines* //if this was in multiple lines i wouldn't have this problem preg_match_all('/<a href="\/How_I_Met_Your_Mother\/season-1\/episode-1\/search\?page=.*/', $html, $pages); preg_match_all('#<a.+href="/How_I_Met_Your_Mother/season-\d+/episode-\d+/search\?page=\d+.+?">[^<]+</a>#', $html, $pages); for ($i=0;$i<sizeof($pages[0]);$i++) { echo $pages[0][$i]; echo $pages[0][0]; echo $pages[0][1]; //////////////////////////////////////////this would give undefined index } any suggestions would be appreciated.
  3. sorry about the mistake i made above here is what i need: hi, i would like for this regexp preg_match_all('/<a href="\/How_I_Met_Your_Mother\/season-.+[^next]/', $html, $link, PREG_PATTERN_ORDER); to grab only somthing like this: <a href="/How_I_Met_Your_Mother/season-1/episode-1/links/5215143" data-track-action="ClickNonFeaturedLSRPLink" rel="nofollow">videobb.com</a> not this: <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2" rel="next">2</a> or this: <a href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2" class="next_page" rel="next">Next »</a> or this: <a href="/How_I_Met_Your_Mother/season-1/episode-1/search" class="dofollow">search</a> or this: <a href="/How_I_Met_Your_Mother/season-1/episode-1" class="donotfollow sr-blue">Season 1 Episode 1</a> but it is grabing them all! can you give me some pointers thanks
  4. hi, i would like for this regexp preg_match_all('/<a href="\/How_I_Met_Your_Mother\/season-.+[^next]/', $html, $link, PREG_PATTERN_ORDER); to grab only somthing like this: <a rel="nofollow" data-track-action="ClickNonFeaturedLSRPLink" href="/How_I_Met_Your_Mother/season-1/episode-1/links/5215143">videobb.com</a> not this: <a rel="next" href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2">2</a> or this: <a rel="next" class="next_page" href="/How_I_Met_Your_Mother/season-1/episode-1/search?page=2">Next »</a> or this: <a class="dofollow" href="/How_I_Met_Your_Mother/season-1/episode-1/search">search</a> or this: <a class="donotfollow sr-blue" href="/How_I_Met_Your_Mother/season-1/episode-1">Season 1 Episode 1</a> but it is grabing them all! can you give me some pointers thanks
  5. ****************disregard the last post please*********************** should this work?? $title[1]='faster'; $html_poster_link = file_get_contents('http://www.rottentomatoes.com/search/full_search.php?search=Faster'); if (preg_match('/<a href="\/m\/'.$title[1].'-2\/.*?/i', $html_poster_link, $poster_link)) if i am looking for if yes then why it is not working for me??
  6. should this work?? $title[1]='Faster'; $html_poster_link = file_get_contents('http://www.rottentomatoes.com/search/full_search.php?search=Faster'); if (preg_match('/<a href="\/m\/'.$title[1].'-2010\/.*?/i', $html_poster_link, $poster_link)) if i am looking for if yes then why it is not working for me??
  7. this script saves the image from a url to the folder were this script is saved, how can i make this code save images into specific folder such as "/image/poster_image/" <?php $img[]='http://images.rottentomatoescdn.com/images/redesign/poster_default.gif'; foreach($img as $i){ echo $i; save_image($i); // if(getimagesize(basename($i))){ // echo '<h3 style="color: green;">Image ' . basename($i) . ' Downloaded OK</h3>'; // }else{ // echo '<h3 style="color: red;">Image ' . basename($i) . ' Download Failed</h3>'; // } } //Alternative Image Saving Using cURL seeing as allow_url_fopen is disabled - bummer function save_image($img,$fullpath='basename'){ if($fullpath=='basename'){ $fullpath = basename($img); } $ch = curl_init ($img); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); $rawdata=curl_exec($ch); curl_close ($ch); if(file_exists($fullpath)){ unlink($fullpath); } $fp = fopen($fullpath,'x'); fwrite($fp, $rawdata); fclose($fp); } ?>
  8. sorry guys but i didn't realize that preg_match was case sensitive
  9. $html_poster_link = file_get_contents('http://www.rottentomatoes.com/m/hop_2011/');
  10. i do want to pair them but if this realy work then this should work but it doesnt if (preg_match('/<a href="\/m\/'.$title[1].'_2011\/.*/', $html_poster_link, $poster_link)) { ECHO"YES"; } !!!
  11. how can i make this work?? i have this variable $title[1] and wanna insert it in the preg_march like so this doesnt work how can i make it work??
  12. this is a code that gets the link of the video from a website of one page <?php $html = file_get_contents('http://test.com/movie.php?id=7333'); if (preg_match('/<param name="movie".*/', $html, $matches)) { echo "1- Match was found <br />"; echo $matches[0]; } ?> i would like to make it search such contents from the whole website test.com not just test.com/movie.php?id=7333 any idea how to do that???
  13. i have a banner that changes image every couple of seconds that retrieve the images from a static images like so: old code: var image1=new Image() image1.src="uploads/firstcar.gif" var image2=new Image() image2.src="uploads/secondcar.gif" var image3=new Image() image3.src="uploads/thirdcar.gif" var image4=new Image() image3.src="uploads/cat.gif" <div class="banner"> <p class="banner_image"> <a href="http://www.w3.org/"> <img src="banner/123.jpg" name="slide" width="290px"> <script> <!-- //variable that will increment through the images var step=1 function slideit(){ //if browser does not support the image object, exit. if (!document.images) return document.images.slide.src=eval("image"+step+".src") if (step<3) step++ else step=1 //call function "slideit()" every 2.5 seconds setTimeout("slideit()",2500) } slideit() //--> </script> </p> <p class="banner"> <a href="http://www.w3.org/">banner</a> </p> </div> know i want it to retrieve the images from database like so New modifications: <?php $count_im=1; $req=mysql_query("select * from banner"); while ($res=mysql_fetch_array($req)){ ?> var image<?php echo $count_im; ?> =new Image() image<?php echo $count_im; ?>.src="<?php echo $res["banner"]; ?>" <?php $count_im++; }?> but the problem is that it know freezes on the last image, it doesn't loop!! any ideas how to fix it
  14. if this was in variable $x and i want it to become any one can 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.