
Modernvox
Members-
Posts
412 -
Joined
-
Last visited
Never
Everything posted by Modernvox
-
Great rajiv, thanks Now if i wanted to display just 50 per page. How would I approach that?
-
<?php if(isset($_POST['submit'])) $st = $_POST['state']; if ($st == "AL") { $url = array("http://auburn.craigslist.org", "http://bham.craigslist.org"); } else if ($st == "AK") { $url= "http://anchorage.craigslist.org"; } else if ($st == "AZ") { $url= "http://anchorage.craigslist.org"; } $html = file_get_contents("$url/muc/"); preg_match_all('/<a href="([^"]+)">([^<]+)<\/a><font size="-1">([^"]+)<\/font>/s', $html,$posts,PREG_SET_ORDER); //echo "<pre>";print_r($posts); foreach ($posts as $post) { //print $post[0]; //HTML $post[2] = str_ireplace($url,"",$post[2]); //remove domain echo "<a href=\"$url{$post[1]}\">{$post[2]}<font size=\"3\">{$post[3]}<br />"; print "<BR />\n"; } ?>
-
The word Array is being included as part of the URL's, How do I strip it out of there? Error: Warning: file_get_contents(Array/muc/) [function.file-get-contents]: failed to open stream: No such file or directory in /home/a7250761/public_html/page2.php on line 131
-
Thanks Thorpe
-
Just want to know if it's possible to scrape multiple pages in sequence with PHP or do I need to use Curl as well? example: if ($x == $z) $open = "mysite.com/zzy, mysite.com/ssy, mysite.com./wwy"; This would have to be an array, right? Or how could I approach this?
-
<?php $url = "http://southcoast.craigslist.org"; $html = file_get_contents("$url/muc/"); preg_match_all('/<a href="([^"]+)">([^<]+)<\/a><font size="-1">([^"]+)<\/font>/s', $html,$posts,PREG_SET_ORDER); //echo "<pre>";print_r($posts); foreach ($posts as $post) { //print $post[0]; //HTML $post[2] = str_ireplace($url,"",$post[2]); //remove domain echo "<a href=\"$url{$post[1]}\">{$post[2]}<\/a><font size=\"-1\">{$post[3]}<\/font>"; print "<BR />\n"; } ?> That's it for this step
-
Hi Guyz. I have a working web scraping script that returns musicians ads from CL. The problem is I have implemented a US States html form and depending on the users choice of State it is suppose to return the corresponding ads. Instead it keeps displaying a blank white page? Here is the html form: <form action="test.php" method="POST"> <select name="state"> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="DC">District of Columbia</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="OH">Ohio</option> <option value="OK">Oklahoma</option> <option value="OR">Oregon</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select> <input type="submit" value="submit" name="submit"><br /> </form><br /> Here is the php code: <?php if(isset($_POST['submit'])) $st = $_post['state']; if ($st == "AL") { $url = "http://southcoast.craigslist.org"; $html = file_get_contents("$url/muc/"); preg_match_all('/<a href="([^"]+)">([^<]+)<\/a><font size="-1">([^"]+)<\/font>/s', $html,$posts,PREG_SET_ORDER); //echo "<pre>";print_r($posts); } foreach ($posts as $post) { //print $post[0]; //HTML $post[2] = str_ireplace($url,"",$post[2]); //remove domain echo "<a href=\"$url{$post[1]}\">{$post[2]}<\/a><font size=\"-1\">{$post[3]}<\/font>"; print "<BR />\n"; } ?> As always thanks for your time answering questions.
-
Yep, Took out the extra / after echo "<a href=\"$url/{$post[1]}\and it works as expected. Thank You
-
Understood MT , I have the text/data in check , but why can't I get the link to be active? It just keeps pointing to localhost or wherever else I run the script. I want it to open in it's original location which is craigslist
-
Displays the data, but without working link displays as: /muc/1534468295.htmlLookin for a rockin singer for working band - (SE Mass) /muc/1533839037.htmlFemale Singer needed - (providence) /muc/1533816253.htmlJANUARY 8th, FRIDAY NIGHT - ROCK / PUNK / PSYCHOBILLY - (New Bedford) Notice the muc/1534468295.html in front? This shouldn't be showing there..
-
Happy New Year Guyz Hope everyone made it out okay I have this code which returns CL Postings pertaining to Musicians. The only problems I see are: 1. It shows array[0] being the data i need, but in the script it shows array/Post[1] being printed which is confusing me? Is it Array[0] or Array[1] being displayed first in the script? Also, I need the link to remain intact, that is, linking back to CL. So here's what the output is that I need which are actually links: However I DO NOT want the Array syntax included i.e. [0] =>, [1] => etc.. [0] => Female Singer needed - (providence) [1] => JANUARY 8th, FRIDAY NIGHT - ROCK / PUNK / PSYCHOBILLY - (New Bedford) [2] => Looking for a musician who is very open minded?.. - (New Bedford / Rochester) [3] => DRUMMER/VOCALS - (SE MASS) [4] => Gig for gig... - (Boston) [5] => BASS AVAILABLE For Bluesy,Rootsy,Classic,Hard Rock. - (Cape / Boston / RI) [6] => Songwriters ????? - (south coast) [7] => New Years Eve Party - (Belmont Club Fall River) [8] => we need a frontman and bassist - (new bedford ma) [9] => LOOKING FOR BASS PLAYER - (Taunton, MA) [10] => Band Ready to Gig Seeks Bassist - (Southcoast,MA) [11] => Progressive Psychedelic Rock Band Auditioning Drummers - (Plymouth) [12] => DRUM LESSONS>>>>>>>with Mike Levesque - (S.E. MA) [13] => 4 BAD MOTHERFUCKER shows this wek - (new bedford) [14] => Singing in the bedroom..."Start" the Jam - (Stuck in the 80's) Here is my code: <?php $html = file_get_contents("http://southcoast.craigslist.org/muc/"); preg_match_all('/<a href="([^"]+)">([^<]+)<\/a><font size="-1">([^"]+)<\/font>/s', $html,$posts); echo "<pre>";print_r($posts); foreach ($posts as $post) { print $post[1]; } ?> Any help greatly appreciated.
-
Could you please explain the workings of using the foreach statement? Yes, I have spent much time reading on this. Maybe someone has the gift of communicating this to me in an easy to understand manner. Maybe a simple example would help? -I guess I can't comprehend why we need foreach() why can't we just print or echo the $matches[1]? -Why does the $matches only display one match when there are at least 50 on each page? $CL= Craigslist See.. I am attempting to scrape musician ads from CL, but leave the link intact leading back to CL. I get the information I need , but only one or two ads are scraped. Not only that , but the links are not linking back to CL and also the ads are being mirrored (2 in a row of the same. Here is my current code: <?php $html = file_get_contents("http://southcoast.craigslist.org/muc/"); preg_match_all('/<a href="([^"]+)">([^<]+)<\/a><font size="-1">([^"]+)<\/font>/s', $html,$posts); foreach ($posts as $post) { print $post[1]; // do something with data } ?> I think if someone explains the workings of the foreach function I can move on. As always, thanks guys!
-
Still waiting
-
I have it displaying: Band needed for NY's Eve - (RI)/muc/1530332391.htmlBand needed for NY's Eve - (RI) Notice it is being repeated? /muc/1530332391.htmlBand needed for NY's Eve - (RI) I need to get rid of the extra post. Also it is only displaying the first one. I need at least 30 to display. Finally, the link is suppose to link back to craigslist , but it links to my localhost?
-
Displayed like such: Band needed for NY's Eve - (RI)Violin and Voice Lessons - (ri)/muc/1530332391.html/muc/1530263612.htmlBand needed for NY's Eve -Violin and Voice Lessons - (RI) (ri) It's just not displaying properly. Should be displaying in similar format as craigslist itself http://providence.craigslist.org/muc/
-
Hi guys, I have this code, but it is not returning the values as I had planned. It shows the title as a local link only and doesn't show more than 2 posts at a time. Here is the output i am getting: Violin and Voice Lessons - (ri)Small Band Practice Space - (Olneyville)/muc/1530263612.html/muc/1530038374.htmlViolin and Voice Lessons -Small Band Practice Space - (ri) (Olneyville) Here is the expected output:<(note: titles should be a link like on Craigslist. D R U M_L E S S O N S>>>>with mike levesque - (RI/MA) Violin and Voice Lessons - (ri) Godsmack tribute"moonbaby" seeks sully - (ri) Huge Band Practice Space - (Olneyville) Small Band Practice Space - (Olneyville) <?php $html = file_get_contents("http://southcoast.craigslist.org/muc/"); preg_match_all('/<a href="([^"]+)">([^<]+)<\/a><font size="-1">([^"]+) <\/font>/', $html,$posts); foreach ($posts as $post) { echo $post[1]; $title = $post[2]; $date = $post[3]; echo $content = $post[4]; // do something with data } ?>
-
Hi guys. I am wanting to scrape just the link, title and location from each post: I have bolded the first one so you may see the text I want to get. <p><a href="/muc/1529797723.html">rock band needs vocals -</a><font size="-1"> (ri)</font></p> <p><a href="/muc/1529790821.html">bass player available -</a><font size="-1"> (newport area)</font></p> Any help is appreciated.
-
Hi everyone, I have a customer who wants a simple site allowing clients to upload videos, pdf's, music etc.. Also needs to accept paypal. Would it be more professional for me to hand code the admin page or use accessories such as Joomla etc..? I never coded an admin page, I enjoy hand coding and could use the experience. Is it hard or is it just a matter of using php to validate & update input? Thanks guys!
-
Display Form Values in a PopUp Window. What Gives??
Modernvox replied to Modernvox's topic in Javascript Help
Figured it out guys. Problem was I never refreshed my browser before previewing the changes :-) Thanks guys! -
Guess it's been a while new look eh? Anyhow, I have been trying and trying and trying some more to get my form to display the users selections/values in a small popup window, but every time.. the window displays on a full screen. I used many code snippets to no avail. The most recent I used was the following: <form name="form" method="post" action="quote_results.php" target="_popup" onsubmit="return openPopup()"> I also have the function set up in the php file as well. Don't matter doesn't work anyhow, right? I have spent some time searching for a solution, but with no JS skills whatsoever I am frustrated to say the least. It looks simple on paper, so what gives? P.S. I have used height and size attributes as well with no luck. Thanks in Advance!