PHP - Please Help With My Extraction
Hey,
I have a script that is meant to grab links of a specific type. Code: [Select] <?php //need to some how extract all links from this text $link = '[quote]http://www.domain.com/?d=03WO6WPC random text, http://www.domain.com/?d=0334fWPChttp://www.domain.com/?d=03WV4SPC[/quote]'; ?> The urls are always the same character length, but there is no telling how the user types them out so im looking for a way to extract the 3 urls based on domain.com. The end result should be to create an array of 3 urls which belong to domain.com . I tried explode but some one may type it without spaces so explode fails.. any ideas? Similar TutorialsI currently have an array called: $find[pagetext] In this array, there is going to be one to several instances where I am looking for a specific forum coding called: [url=http://megaupload.com/?d=X]http://megaupload.com/?d=X[/url] Everyone has used megaupload but what this script basically is going to do is check the validity of the upload site the user has chosen. Above I selected megaupload but there are about 6 sites I am going to check in the code I'm writing. I'm stuck on 1 part. How can I extract from $find[pagetext] all occurances of the website (In this case) megaupload and assign each instance to array. Once I assign it to an array I've already written a function that will check and see if the web link is valid I just need to basically extract each URL occurance of megaupload or whatever the upload site I am checking there is. All help is greatly appreciated. OK, I just want to extract the agency name, complete address, and phone number from this mess : {"facilities": [ { "fclt_name":"BEACH & O'NEILL IN", "fclt_addr":"7520 GREENBACK LN", "fclt_city":"CITRUS HEIGHTS", "fclt_state":"CA", "fclt_zip":"95610", "tel_no":"916.676.0844", "fax_no":"916.676.0860", "fclt_url":"null", "fclt_lattd":"38.6781788", "fclt_longtd":"-121.289615", "fclt_ctgy_cd":"2", "fclt_distance":"3.26341268894218446122718887944106659512" }, { "fclt_name":"AMERICAN AIM AUTO", "fclt_addr":"5341 SAN JUAN AVE", "fclt_city":"FAIR OAKS", "fclt_state":"CA", "fclt_zip":"95628", "tel_no":"916.962.0401", "fax_no":"916.962.0414", "fclt_url":"null", "fclt_lattd":"38.6625015", "fclt_longtd":"-121.2922782", "fclt_ctgy_cd":"2", "fclt_distance":"3.50675708898608342216618250068171298694" }, { "fclt_name":"INSZONE INSURANCE", "fclt_addr":"7200 FAIR OAKS BLVD STE 210", "fclt_city":"CARMICHAEL", "fclt_state":"CA", "fclt_zip":"95608", "tel_no":"916.503.8784", "fax_no":"916.486.4335", "fclt_url":"null", "fclt_lattd":"38.631717", "fclt_longtd":"-121.327626", "fclt_ctgy_cd":"2", "fclt_distance":"4.01207784800582596431030369642981690151" }, { "fclt_name":"PARK FAMILY INS &", "fclt_addr":"801 RIVERSIDE AVE STE 100", "fclt_city":"ROSEVILLE", "fclt_state":"CA", "fclt_zip":"95678", "tel_no":"888.723.7275", "fax_no":"866.772.2912", "fclt_url":"null", "fclt_lattd":"38.732289", "fclt_longtd":"-121.289295", "fclt_ctgy_cd":"2", "fclt_distance":"4.47210016333570016664044149856001806252" }, { "fclt_name":"RK JACOBS INSURANC", "fclt_addr":"4777 SUNRISE BLVD STE B", "fclt_city":"FAIR OAKS", "fclt_state":"CA", "fclt_zip":"95628", "tel_no":"916.966.3733", "fax_no":"916.966.0177", "fclt_url":"null", "fclt_lattd":"38.6525671", "fclt_longtd":"-121.2728244", "fclt_ctgy_cd":"2", "fclt_distance":"4.75887214653382230652493164121477832758" }, { "fclt_name":"BERTOLINO INSURANC", "fclt_addr":"2985 FULTON AVE", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95821", "tel_no":"916.384.9621", "fax_no":"877.553.0066", "fclt_url":"null", "fclt_lattd":"38.6190831", "fclt_longtd":"-121.4015452", "fclt_ctgy_cd":"2", "fclt_distance":"5.50381610176691043722708919483708216851" }, { "fclt_name":"THE PEXA GROUP", "fclt_addr":"1221 PLEASANT GROVE BLVD", "fclt_city":"ROSEVILLE", "fclt_state":"CA", "fclt_zip":"95678", "tel_no":"916.788.4200", "fax_no":"916.788.4204", "fclt_url":"null", "fclt_lattd":"38.772237", "fclt_longtd":"-121.308503", "fclt_ctgy_cd":"2", "fclt_distance":"6.25871993199859278950600593840623920844" }, { "fclt_name":"PARAMOUNT EQUITY I", "fclt_addr":"8781 SIERRA COLLEGE BLVD", "fclt_city":"ROSEVILLE", "fclt_state":"CA", "fclt_zip":"95661", "tel_no":"877.284.2424", "fax_no":"888.811.2910", "fclt_url":"null", "fclt_lattd":"38.7424319", "fclt_longtd":"-121.2511908", "fclt_ctgy_cd":"2", "fclt_distance":"6.50250135161509994547872070619122902873" }, { "fclt_name":"PETERSON & GRANTHA", "fclt_addr":"1508 EUREKA RD STE 175", "fclt_city":"ROSEVILLE", "fclt_state":"CA", "fclt_zip":"95661", "tel_no":"916.431.0400", "fax_no":"916.431.0221", "fclt_url":"null", "fclt_lattd":"38.749593", "fclt_longtd":"-121.250556", "fclt_ctgy_cd":"2", "fclt_distance":"6.83036958706746253088617532680453999753" }, { "fclt_name":"INDEPENDENT SOL UN", "fclt_addr":"2723 ZINFANDEL DR", "fclt_city":"RANCHO CORDOVA", "fclt_state":"CA", "fclt_zip":"95670", "tel_no":"916.635.6760", "fax_no":"916.635.9804", "fclt_url":"null", "fclt_lattd":"38.5967846", "fclt_longtd":"-121.2894781", "fclt_ctgy_cd":"2", "fclt_distance":"7.03267554456276560054938083160853750814" }, { "fclt_name":"MORE CHOICES INS A", "fclt_addr":"1474 STONE POINT DR # 131", "fclt_city":"ROSEVILLE", "fclt_state":"CA", "fclt_zip":"95661", "tel_no":"916.899.6600", "fax_no":"916.647.0522", "fclt_url":"null", "fclt_lattd":"38.755322", "fclt_longtd":"-121.249216", "fclt_ctgy_cd":"2", "fclt_distance":"7.14043819089449986827741629585808532375" }, { "fclt_name":"ALBANO DALE DUNN &", "fclt_addr":"9197 GREENBACK LN", "fclt_city":"ORANGEVALE", "fclt_state":"CA", "fclt_zip":"95662", "tel_no":"916.988.0214", "fax_no":"916.989.4719", "fclt_url":"null", "fclt_lattd":"38.678737", "fclt_longtd":"-121.212147", "fclt_ctgy_cd":"2", "fclt_distance":"7.40385556560869808878938590652772224486" }, { "fclt_name":"MCGEE & THIELEN IN", "fclt_addr":"3780 ROSIN CT STE 120", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95834", "tel_no":"916.646.1919", "fax_no":"916.646.0995", "fclt_url":"null", "fclt_lattd":"38.636195", "fclt_longtd":"-121.473132", "fclt_ctgy_cd":"2", "fclt_distance":"7.57412262483417036891911065525086823482" }, { "fclt_name":"AGENTS RESOURCES I", "fclt_addr":"11190 SUN CENTER DR", "fclt_city":"RANCHO CORDOVA", "fclt_state":"CA", "fclt_zip":"95670", "tel_no":"916.443.4221", "fax_no":"916.443.5559", "fclt_url":"null", "fclt_lattd":"38.597237", "fclt_longtd":"-121.267659", "fclt_ctgy_cd":"2", "fclt_distance":"7.61684981655654181229982085243856553867" }, { "fclt_name":"STEVE C LUTH INS", "fclt_addr":"9480 MADISON AVE STE 1", "fclt_city":"ORANGEVALE", "fclt_state":"CA", "fclt_zip":"95662", "tel_no":"888.597.8383", "fax_no":"916.989.9102", "fclt_url":"null", "fclt_lattd":"38.6735726", "fclt_longtd":"-121.2007054", "fclt_ctgy_cd":"2", "fclt_distance":"8.053760009460164598304836725423812559" }, { "fclt_name":"MCDOWALL & KEENEY", "fclt_addr":"865 HOWE AVE STE 200", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95825", "tel_no":"916.567.3233", "fax_no":"916.567.3155", "fclt_url":"null", "fclt_lattd":"38.581372", "fclt_longtd":"-121.41588", "fclt_ctgy_cd":"2", "fclt_distance":"8.16424077949136484737583499892043887019" }, { "fclt_name":"SIERRA OAK INS SER", "fclt_addr":"9700 BUSINESS PARK DR STE 105", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95827", "tel_no":"916.364.7380", "fax_no":"916.364.7381", "fclt_url":"null", "fclt_lattd":"38.568104", "fclt_longtd":"-121.334623", "fclt_ctgy_cd":"2", "fclt_distance":"8.27507991633456734395325050580063137134" }, { "fclt_name":"RICHARD CHRISTOPHE", "fclt_addr":"5842 LONETREE BLVD", "fclt_city":"ROCKLIN", "fclt_state":"CA", "fclt_zip":"95765", "tel_no":"916.626.3305", "fax_no":"916.471.0311", "fclt_url":"null", "fclt_lattd":"38.8065456", "fclt_longtd":"-121.293125", "fclt_ctgy_cd":"2", "fclt_distance":"8.76951297025304552186130788422901665504" }, { "fclt_name":"ADEPT INSURANCE SE", "fclt_addr":"101 PARKSHORE DR STE 30061", "fclt_city":"FOLSOM", "fclt_state":"CA", "fclt_zip":"95630", "tel_no":"916.944.2192", "fax_no":"866.529.5303", "fclt_url":"null", "fclt_lattd":"38.6570589", "fclt_longtd":"-121.186783", "fclt_ctgy_cd":"2", "fclt_distance":"8.9960609261835699863946424309422450653" }, { "fclt_name":"PARAGON INSURANCE", "fclt_addr":"301 NATOMA ST STE 104", "fclt_city":"FOLSOM", "fclt_state":"CA", "fclt_zip":"95630", "tel_no":"916.353.1023", "fax_no":"916.353.1370", "fclt_url":"null", "fclt_lattd":"38.678047", "fclt_longtd":"-121.168827", "fclt_ctgy_cd":"2", "fclt_distance":"9.73781780936977222523189878525699239046" }, { "fclt_name":"CLINTON POLLEY GRO", "fclt_addr":"1675 CREEKSIDE DR STE 100", "fclt_city":"FOLSOM", "fclt_state":"CA", "fclt_zip":"95630", "tel_no":"916.984.3000", "fax_no":"916.984.3100", "fclt_url":"null", "fclt_lattd":"38.6716438", "fclt_longtd":"-121.1446657", "fclt_ctgy_cd":"2", "fclt_distance":"11.07358533782419719432038848742812184727" }, { "fclt_name":"ALPHA BOND INSURAN", "fclt_addr":"3918 60TH ST", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95820", "tel_no":"866.313.3077", "fax_no":"916.429.7974", "fclt_url":"null", "fclt_lattd":"38.5393731", "fclt_longtd":"-121.4344591", "fclt_ctgy_cd":"2", "fclt_distance":"11.21762941497442801416098309046154379963" }, { "fclt_name":"HEBARD INSURANCE A", "fclt_addr":"3837 TAYLOR RD", "fclt_city":"LOOMIS", "fclt_state":"CA", "fclt_zip":"95650", "tel_no":"916.652.0404", "fax_no":"916.652.9123", "fclt_url":"null", "fclt_lattd":"38.81657", "fclt_longtd":"-121.197889", "fclt_ctgy_cd":"2", "fclt_distance":"12.08374482196660408349940289432841322946" }, { "fclt_name":"PILCHER INSURANCE", "fclt_addr":"3805 TAYLOR RD STE 1", "fclt_city":"LOOMIS", "fclt_state":"CA", "fclt_zip":"95650", "tel_no":"916.660.1670", "fax_no":"916.660.1672", "fclt_url":"null", "fclt_lattd":"38.817032", "fclt_longtd":"-121.197206", "fclt_ctgy_cd":"2", "fclt_distance":"12.13211505726556203701939114285606195057" }, { "fclt_name":"RUSSELL VANG INS &", "fclt_addr":"2751 FRUITRIDGE RD STE 15", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95824", "tel_no":"916.428.2267", "fax_no":"916.428.2341", "fclt_url":"null", "fclt_lattd":"38.517011", "fclt_longtd":"-121.4513314", "fclt_ctgy_cd":"2", "fclt_distance":"13.00258097375703227426814846084345607012" }, { "fclt_name":"PC INSURANCE AGENC", "fclt_addr":"6333 STOCKTON BLVD STE A", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95824", "tel_no":"916.391.5990", "fax_no":"916.391.5993", "fclt_url":"null", "fclt_lattd":"38.5111875", "fclt_longtd":"-121.4360945", "fclt_ctgy_cd":"2", "fclt_distance":"13.04926930736758364287316544823571444809" }, { "fclt_name":"GOLDENBEST INSURAN", "fclt_addr":"6830 STOCKTON BLVD # 100", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95823", "tel_no":"916.231.9955", "fax_no":"916.231.9954", "fclt_url":"null", "fclt_lattd":"38.502632", "fclt_longtd":"-121.43303", "fclt_ctgy_cd":"2", "fclt_distance":"13.54608070539524090996150854589636455506" }, { "fclt_name":"EDWARD C BRODIE IN", "fclt_addr":"2379 GATEWAY OAKS DR STE 150", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95822", "tel_no":"916.927.6343", "fax_no":"916.927.8848", "fclt_url":"null", "fclt_lattd":"38.5128714", "fclt_longtd":"-121.4970294", "fclt_ctgy_cd":"2", "fclt_distance":"14.46565232261373440674810015002201060961" }, { "fclt_name":"LINH DO INSURANCE", "fclt_addr":"6511 SAVINGS PL STE 115", "fclt_city":"SACRAMENTO", "fclt_state":"CA", "fclt_zip":"95828", "tel_no":"916.393.8383", "fax_no":"916.393.8382", "fclt_url":"null", "fclt_lattd":"38.4739858", "fclt_longtd":"-121.3884671", "fclt_ctgy_cd":"2", "fclt_distance":"14.89569563450147516294105371450235166475" }, { "fclt_name":"STRATTON AGENCY", "fclt_addr":"957 INDUSTRIAL RD STE C", "fclt_city":"SAN CARLOS", "fclt_state":"CA", "fclt_zip":"95762", "tel_no":"650.508.0124", "fax_no":"650.508.0121", "fclt_url":"null", "fclt_lattd":"38.6637192", "fclt_longtd":"-121.067907", "fclt_ctgy_cd":"2", "fclt_distance":"15.24924065635783489201051962237991277729" }, { "fclt_name":"PACIFIC INTERSTATE", "fclt_addr":"5072 HILLSDALE CIR STE 110", "fclt_city":"EL DORADO HILLS", "fclt_state":"CA", "fclt_zip":"95762", "tel_no":"916.941.0518", "fax_no":"916.941.0547", "fclt_url":"null", "fclt_lattd":"38.621938", "fclt_longtd":"-121.062804", "fclt_ctgy_cd":"2", "fclt_distance":"16.0891004210135393693458563137933030129" }, { "fclt_name":"AMAZING INSURANCE", "fclt_addr":"8398 LAPORTE WAY", "fclt_city":"ELK GROVE", "fclt_state":"CA", "fclt_zip":"95624", "tel_no":"916.719.6449", "fax_no":"916.258.6679", "fclt_url":"null", "fclt_lattd":"38.445406", "fclt_longtd":"-121.394576", "fclt_ctgy_cd":"2", "fclt_distance":"16.89751994304863412037777682922840849653" }, { "fclt_name":"WAHLA INSURANCE &", "fclt_addr":"4809 LAGUNA BLVD STE 100", "fclt_city":"ELK GROVE", "fclt_state":"CA", "fclt_zip":"95758", "tel_no":"916.429.4741", "fax_no":"916.429.4743", "fclt_url":"null", "fclt_lattd":"38.424506", "fclt_longtd":"-121.449703", "fclt_ctgy_cd":"2", "fclt_distance":"18.95918985420010413223068782438653209117" }, { "fclt_name":"MOTHER LODE INS SE", "fclt_addr":"2514 CAMEO DR STE A", "fclt_city":"CAMERON PARK", "fclt_state":"CA", "fclt_zip":"95682", "tel_no":"530.677.8755", "fax_no":"530.677.8314", "fclt_url":"null", "fclt_lattd":"38.6578609", "fclt_longtd":"-120.999481", "fclt_ctgy_cd":"2", "fclt_distance":"18.96331840626573060295348092634463597585" }, { "fclt_name":"WOODEL INSURANCE", "fclt_addr":"8788 ELK GROVE BLVD STE P", "fclt_city":"ELK GROVE", "fclt_state":"CA", "fclt_zip":"95624", "tel_no":"916.714.5122", "fax_no":"916.714.5123", "fclt_url":"null", "fclt_lattd":"38.408374", "fclt_longtd":"-121.377051", "fclt_ctgy_cd":"2", "fclt_distance":"19.33537262024884176605153693999802777133" }, { "fclt_name":"AMAN INSURANCE AGE", "fclt_addr":"8788 ELK GROVE BLVD BLDG 3", "fclt_city":"ELK GROVE", "fclt_state":"CA", "fclt_zip":"95624", "tel_no":"916.213.1900", "fax_no":"800.714.6082", "fclt_url":"null", "fclt_lattd":"38.408374", "fclt_longtd":"-121.377051", "fclt_ctgy_cd":"2", "fclt_distance":"19.33537262024884176605153693999802777133" }, { "fclt_name":"MULHOLLAND INSURAN", "fclt_addr":"2358 MARITIME DR STE 100", "fclt_city":"ELK GROVE", "fclt_state":"CA", "fclt_zip":"95758", "tel_no":"916.691.5555", "fax_no":"916.691.0555", "fclt_url":"null", "fclt_lattd":"38.413727", "fclt_longtd":"-121.483123", "fclt_ctgy_cd":"2", "fclt_distance":"20.24810658073937047943171540052851815376" }, { "fclt_name":"SILLECT INSURANCE", "fclt_addr":"100 KENTUCKY AVE", "fclt_city":"WOODLAND", "fclt_state":"CA", "fclt_zip":"95695", "tel_no":"530.662.9050", "fax_no":"888.613.5849", "fclt_url":"null", "fclt_lattd":"38.691387", "fclt_longtd":"-121.781223", "fclt_ctgy_cd":"2", "fclt_distance":"23.3148181263597264149496516029276053035" }, { "fclt_name":"VAUGHT WRIGHT & BO", "fclt_addr":"533 MAIN ST", "fclt_city":"PLACERVILLE", "fclt_state":"CA", "fclt_zip":"95667", "tel_no":"530.622.1835", "fax_no":"530.622.3860", "fclt_url":"null", "fclt_lattd":"38.7298", "fclt_longtd":"-120.798354", "fclt_ctgy_cd":"2", "fclt_distance":"29.83338181060752344743347837235784856168" }, { "fclt_name":"DARR INSURANCE AGE", "fclt_addr":"550 MAIN ST", "fclt_city":"PLACERVILLE", "fclt_state":"CA", "fclt_zip":"95667", "tel_no":"530.217.6002", "fax_no":"530.626.4590", "fclt_url":"null", "fclt_lattd":"38.728995", "fclt_longtd":"-120.797821", "fclt_ctgy_cd":"2", "fclt_distance":"29.85673424682092359769083672633797070566" } ] } hello, I am trying to figure out how I can take only the v= in the youtube urls http://www.youtube.com/watch?v=nGawAhRjtoA&feature=topvideos i just want php to take v=nGawAhRjtoA and ignore everything else any ideas guys/gals? thanks This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=353645.0 I am in the process of teaching myself PHP/MySQL. I have taught myself other programming languages in the past so its not that i can't learn. but as i'm new and trying to learn both at the same time, i'm needing some help with php / mysql to datamine either of the following sites. www.findchips.com www.eciaauthorized.com WHat i want to do is after putting in the part number, for each distributor that returns data i want to extract the following data for each distributor Quantity Break Resale at quantity break Current Stock I want to write the data into a field in the database that holds the p/n's and my company's resale. I'm wanting to do this as an exercise so that i can dynamically benchmark my resales against that of my competitors. To get a feel of the data that is returned, please use the following p/n. 1n4001-e3/54 any and all help would be greatly appreciated My db table has columns "id" (int-11), "date(varchar-50)", "author name(varchar-100)", "text (varchar-100000)"... I am storing images + text in text field of database. Everything is going fine while i am using ckeditor to insert data into the database for that particular text field. Now when i am retrieving data from database... i am able to extract id, date, autorname successfully (i have check it while the issue came)..but when i am trying to retrieve text field which have image, that jumps to page not found error... what could be the issue... am i having problem with database or editor that i am using???? Hi everyone, I do not know if this is the right place to ask the following, but I know all the php guru's read here. So please take a moment to read and please help point me in the right direction. I have a php website that I am developing, it is a job website, where my problem is that I need to be able to extract text from the following file formats: doc, docx, rtf, txt and maybe pdf. I have googled and done research on this subject, but I do not find any php scripts that can do the job properly. I have found a java app developed by apache that does the text extraction perfectly, called apache tika. (calling it using exec is really a problem, since most hosts don't provide root access.) I need a way to use this with php. If you know of any other method that I can do this, please help and suggest as this is a major bridge that I have to cross very urgently. your help will be much appreciated, thanks Problem: I'm trying to build a junction table for a many to many relationship. Table A contains a title string that contains in it names that are stored in Table B. Both tables have nearly a million rows. Bad solution: The method I'm using right now is using PHP I fetch and store one table into an associative array. I then do a mysql_fetch loop on the second table and run this code to populate an array that is used to build the multi-insert SQL. $title = preg_replace ($names, $keys, $title); if (preg_match_all ('/(\d+)/', $title, $matches)) foreach ($matches[1] as $m) $inserts[$row['id'].'-'.$m] = 1; This works, but I'm looking for possibly a less cpu/memory intensive method. My remote server can't handle it, and we're talking hours and hours on a local server. It seems the bottleneck is with the preg_replace. I've also tried str_replace, which is only slightly faster. So, a method where I wouldn't have to pass around such large arrays, or an entirely different approach is what I'm looking for. Any ideas? hello, i want to extract the sender_id, sender_alias and text from the array that should be returned when requesting access to direct messages via API. I get the error "Fatal error: Call to undefined method TwitterOAuth::request() " referring to the line $direct_message = $OAuth->request('GET', $OAuth->url('https://api.twitter.com/1/direct_messages.json'), array('sender_id','screen_name' ,'text')); Code: [Select] // create new instance $OAuth = new TwitterOAuth($consumer_key,$consumer_secret, $oAuthToken, $oAuthSecret); $direct_message = $OAuth->request('GET', $OAuth->url('https://api.twitter.com/1/direct_messages.json'), array('sender_id','screen_name' ,'text')); $direct_message = json_decode($OAuth->response['response'], true); echo response; |