PHP - Some Help Need Tags Read From File_get_html
hi friends need some help
i want get title , seed , peer , download link from this url https://kickass.so/games/i am create code but i am not able to found specific tag $html = file_get_html('https://kickass.so/games/'); $last200area = $html->find('table[class="data"]', 0); $last200 = $last200area->find('div[class="torrentname"]'); foreach ($last200 as $onesearch) { $onesearch = strip_tags($onesearch); echo $onesearch; } Similar TutorialsI'm using simple html dom parser. I used it in my web site successfully. But i changed my host company and i can't run my existing codes. "file_get_html" works on some sites. doesn't work on some sites. i couldn't understand the problem. This one works: Code: [Select] include_once ('simple_html_dom.php'); $html1 = file_get_html('http://www.yahoo.com'); echo $html1; Although web site can be opened from my browser, This one doesn't work in php script: Code: [Select] include_once ('simple_html_dom.php'); $html2 = file_get_html('http://www.eksisozluk.com'); echo $html1; ----------------------------- The same problem occurs again when i use in object oriented way. Works: Code: [Select] $html1 = new simple_html_dom(); $address1='http://www.yahoo.com'; $html1->load_file($address1); echo "$html1"; Doesn't work: Code: [Select] $html2 = new simple_html_dom(); $address2='http://www.eksisozluk.com'; $html2->load_file($address2); echo "$html2"; The error is: Warning: file_get_contents(http://www.eksisozluk.com) [function.file-get-contents]: failed to open stream: HTTP request failed! in /home/mysite/public_html/myfolder/simple_html_dom.php on line 850 Fatal error: Call to a member function innertext() on a non-object in /home/mysite/public_html/myfolder/simple_html_dom.php on line 1364 Hello,
I try to get website speed of some website, but i can read only ''domain.com'' i can't read website files like css , js ... why ? i use proxies for this job.
here is the php code:
$options = array( 'useragent' => "Firefox (+http://www.firefox.org)", // who am i 'connecttimeout' => 120, // timeout on connect 'timeout' => 120, // timeout on response 'redirect' => 10, // stop after 10 redirects 'referer' => "http://www.google.com", 'proxyhost' =>'85.25.8.14:80' ); $response = http_get("http://solve-ict.com/wp-content/themes/ict%20theme/js/jquery-1.7.1.min.js", $options , $info);but it works fine with http://domain.com/ , but with files css or js it gives 404, using some free proxy servers available ? Thanks. Trying to get this done: Page_1 has many external links, when certain links are clicked i do not want user to go directly to page, but rather go to a special add page_2 where user must click a second time on the link to finally get there. The add page_2 must show on screen the name of the initial link from page_1, it must change accordingly with the link it came from page_1,once on page_2 the hyperlink redirects outside the site. So far i am thinking give an id to the div or "<a href..." on page_1 then somehow have page_2 detect that id and fill in the variable for the final external link. Other wise is there a way to detect a url from incoming? I guess a similar example is how some domain name sellers landing page will indicate the name of the site. Such as "Thisdomain.com" is for sale. same landing page but the name changes according to the domain that was typed. hi everyone, did not know what to make the subject, but here is what I want to do: I have a string, which gets returned to me from a linux app on my server, it looks something like this: Code: [Select] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> <TITLE> </TITLE> <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Linux)"> <META NAME="AUTHOR" CONTENT="Administrator"> <META NAME="CREATED" CONTENT="20110106;14170000"> <META NAME="CHANGEDBY" CONTENT="HOD"> <META NAME="CHANGED" CONTENT="20110522;16540000"> <STYLE TYPE="text/css"> <!-- @page { margin: 0.26in } P { margin-bottom: 0.15in; direction: ltr; color: #000000; line-height: 0.15in; text-align: justify; widows: 2; orphans: 2 } P.western { font-family: "Arial", sans-serif; font-size: 10pt; so-language: en-US } P.cjk { font-family: "Batang", "바탕", serif; font-size: 10pt } P.ctl { font-family: "Times New Roman", serif; font-size: 10pt; so-language: ar-SA } A:link { color: #0000ff } --> </STYLE> </HEAD> <BODY LANG="en-US" TEXT="#000000" LINK="#0000ff" DIR="LTR" STYLE="border: 5.05pt double #000000; padding: 0.67in 0.92in"> <P>I want this and the tags around it, just not the html, head, body and their closing tags.</P> </BODY> </HTML> within the body, the tags are each styled for example: <p style="color: red"></p> so I cannot just get rid of all html, I want to get only all the content within the body tags, but without the body tags obviously strip_tags does not work as i need, I only want to strip certain tags. If someone can help me with this i will much appreciate it. I am asking out of curiosity, how does this problem usually get solved, when using a tag system to sort content, and users enter similar tags. For example: flower and flowers... which means the difference between singular and plural. Judging by other sites which are around, this problem is not solved at all, they simply let you add as many tags as you want and then rank the most used tags, it indeed is a solution, but seems more like a walk-around solution to me. Any ideas how somebody could approach to solve this one? EDIT: My suggestion would be an analysis function, which analyzes the entered tag and then suggests the user that similar tags have been already entered and perhaps he wants to choose one of those which have been already entered. This does work though with a high traffic websites what can happen is the following: php and php5 You can end up with two similar tags which are both widely used though have different meanings to the user base. This one could be solved by simply prohibiting similar tags with little additions or changes, and so to speak "forcing" the user to choose something which is already there. May be a way, though it can turn out as a bad solution as well. I got a question im using izabi for me im one who loves the software. But there some quirks that they forgot to add when making the mail system. I was wondering how it would be possible to code in a peice of php where it says read after someone read the email. If you need a copy of the mail mail script let me know. Do anyone know how i can put the html tags in the same line as the other html tags? Here's an example: Code: [Select] Images | Link | Delete | Enabled On my code, it break the tags to the new line without put on the same line as the other tags. Here's the code: Code: [Select] [code]<?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'myusername'); define('DB_PASSWORD', 'mypass'); define('DB_DATABASE', 'mydbtable'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $username = clean($_GET['user']); $password = clean($_GET['pass']); if($username == '') { $errmsg_arr[] = 'username ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'PASSWORD ID missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $qry="SELECT * FROM members WHERE username='$username' AND passwd='$password'"; $result=mysql_query($qry) or die('Error:<br />' . $qry . '<br />' . mysql_error()); if(mysql_num_rows($result) > 0) { $qrytable1="SELECT images, id, public FROM members WHERE username='$username'"; $result1=mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error()); while ($row = mysql_fetch_array($result1)) { echo '<p id="images"> <a href="images.php?id='.$row['id'].'">Images</a></td> | <a href="http://' . $row["links"] . '">Link</a> </td> | <a href="delete.php?id='.$row['id'].'">Delete</a> </td> | <p> <p id="test">'.$row['Public'].'</td>''; } } } ?>[/code] Say I have the following text stored in a MySQL database... Code: [Select] <b>Classic Quote from movie</b> and I retrieve it into a variable called $text, how do I properly echo that so that it keeps the bold tags and actually display the text "Classic quote from movie" in BOLD? I'm doing something wrong somewhere along the line (simply doing "echo $text;") because it displays on the page as... Code: [Select] <b>Classic Quote from movie</b> Instead of... Classic Quote from movie Any info on properly storing and echoing back HTML would be very appreciated. i have this code Code: [Select] <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0"> <channel> <item> <title> tttt1</title> <link>lll1</link> <description> dddd1 </description> </item> <item> <title> tttt2</title> <link>lll2</link> <description> dddd2 </description> </item> <item> <title> tttt3</title> <link>lll3</link> <description> dddd3 </description> </item> and i want go get to array all the details tttt1 lll1 dddd1 tttt2 lll2 dddd2 tttt3 lll3 dddd3 how can i do that simple? I SEE THIS http://il2.php.net/xml_parse but 1)i dont understand this how can i do what i want 2) it is too long and class code i need short and simple please help hi, there is a script or something that can read this file? http://ical.imac.com/ical/portuguese32holidays.ics the ideia is to save all days and holidays for a mysql and then update time to time. thanks for your help Hi everyone, I need some help here. I don't know PHP coding and how to write custom php code for reading a XML in PHP. I have a application which updates the server status in real time and send out the data in XML format. I want to create a PHP page so that can show the data in XML to frontend user... I am pasting the XML code that need to be converted in PHP. Any kind of help will be appreciated. If anybody can give me the code and displaying the data in table format that will be awesome.... Code: [Select] <?xml version="1.0" encoding="UTF-8"?> -<simplehelp_metrics builddate="20120419-123521" version="3.12"> -<technician_metrics> <metric value="2" name="Technicians Logged In" id="tech_logged_in"/> <metric value="0" name="Technicians In Session" id="tech_in_session"/> <metric value="0" name="Technicians In Remote Session" id="tech_in_remote_session"/> </technician_metrics> -<customer_metrics> <metric value="0" name="Customers Logged In" id="cust_logged_in"/> <metric value="0" name="Customers In Session" id="cust_in_session"/> <metric value="0" name="Customers Waiting" id="cust_waiting"/> </customer_metrics> -<server_metrics> <metric value="1" name="Server Maximum Sessions" id="server_max_sessions"/> <metric value="23" name="Server Total Number of Sessions" id="server_total_sessions"/> <metric value="23" name="Server Total Number of Support Sessions" id="server_total_support_sessions"/> <metric value="0" name="Server Total Number of Access Sessions" id="server_total_access_sessions"/> <metric value="21217" name="Average Queue Time" id="server_average_queue_time"/> <metric value="17052" name="Last Queue Time" id="server_last_queue_time"/> <metric value="1830883" name="Average Session Duration" id="server_average_session_time"/> <metric value="5932145" name="Last Session Duration" id="server_last_session_time"/> </server_metrics> -<technicians> <technician name="tlc10271" login="tlc10271"/> <technician name="tlc10072" login="tlc10072"/> </technicians> </simplehelp_metrics> hi, i am requesting bookrenter.com with curl and getting back a response in something like xml format The response is Code: [Select] <response> <book> <info> <isbn13>9780324786453</isbn13> <isbn10>032478645X</isbn10> </info> <prices> <rental_price days="45">$17.43</rental_price> <rental_price days="90">$24.35</rental_price> <rental_price days="60">$20.87</rental_price> <rental_price days="30">$15.87</rental_price> <rental_price days="125">$28.99</rental_price> </prices> <lowest_shipping_price>$0.00</lowest_shipping_price> <availability>In Stock</availability> <url>http://www.shareasale.com/r.cfm?u=&b=96706&m=14293&urllink=www.bookrenter.com%2Fdiscovering-computers-2010-living-in-a-digital-world-complete-shelly-cashman-series-032478645X-9780324786453</url> </book> </response> Now i want to process the response so that it will show the values in user readable form like 45 day's rent is $17.43 90 day's rent is $24.35 60 day's rent is $20.87 30 day's rent is $15.87 125 day's rent is $28.99 Shipping price is $0.00 please help Thanks this is what i have so far: Code: [Select] $var=$_POST["fname"]; $xmlDoc = new DOMDocument(); $xmlDoc->loadXML($var); I would like to use something similar to this included in it before sql insert: Code: [Select] for($c = 0; $c<$node->length; $c++) { 1 root, 4 parents and varying childs I believe? Code: [Select] <node> <building>Number 65</building> <workers><label>executive</label><names>john</names><label>cook</label><names>terry</names><label>waitress</label><names>jill</names><label>buser</label><names>4564646</names><label>Main</label><number>45564646</number><label>home fax</label><number>45964646</number></workers> <food><label>breakfast</label><meal>eggs</meal><label>lunch</label><meal>turkey</meal><label>dinner</label><meal>steak</meal></food> <addresses><label>Home</label><Country>usa</Country><Street>123 mulberry ln </Street><ZIP>57888</ZIP><City>teledo</City><State>Ohio</State><label>location</label><Street>turnpike east 23</Street><City>danbury</City><State>Connecticut</State><Country>USA</Country></addresses> <building>Number 66</building> etc... </node> Thank you! Good morning guys. I am pulling data from vehicle tracking site via soap curl. but the data format that I am getting it in is unusable, maybee i am doing something wrong. please have a look. here is the code. <?php //Data, connection, auth $dataFromTheForm = $_POST['fieldName']; // request data from the form $soapUrl = "https://fleet11.******.co.za/api/"; // asmx URL of WSDL $soapUser = "********"; // username $soapPassword = "********"; // password // xml post structure $xml_post_string = '<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="fleet11.cartrack.co.za/api/"> <soapenv:Header/> <soapenv:Body> <api:endpoint.get_vehicle_last_positions soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <username xsi:type="xsd:string">?</username> </api:endpoint.get_vehicle_last_positions> </soapenv:Body> </soapenv:Envelope>'; $headers = array( "Content-type: application/x-www-form-urlencoded", "Accept: text/xml", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: fleet11.******.co.za/api/#get_vehicle_last_positions", "Content-length: ".strlen($xml_post_string), ); $url = $soapUrl; // var_dump($url); $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); `curl_setopt($ch, CURLOPT_HEADER, true);` // converting $response = curl_exec($ch); curl_close($ch); //paul add //echo "<pre>"; print_r($response); What is returning is single line entries QuoteGMT Server: [32] => Apache X-SOAP-Server: [33] => NuSOAP/0.9.5 [34] => (1.123) Content-Length: [35] => 15407 Vary: [36] => Accept-Encoding,User-Agent Access-Control-Allow-Origin: [37] => * Access-Control-Allow-Methods: [38] => POST, [39] => GET, [40] => OPTIONS Access-Control-Allow-Headers: [41] => Origin, [42] => X-Requested-With, [43] => Content-Type, [44] => Accept Access-Control-Allow-Credentials: [45] => true Content-Type: [46] => text/xml; [47] => charset=UTF-8 version="1.0" [49] => encoding="UTF-8"?> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" [51] => xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" [52] => xmlns:xsd="http://www.w3.org/2001/XMLSchema" [53] => xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" [54] => xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" [55] => xmlns:tns="fleet11.cartrack.co.za/api/"> xsi:type="SOAP-ENC:Array" [57] => SOAP-ENC:arrayType="tns:get_vehicle_last_positionsResultType0Row[20]"> xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">115687333 xsi:type="xsd:string">HG07DPGP xsi:type="xsd:string">2020-07-01 [62] => 08:03:32+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.118315 xsi:type="xsd:double">28.162389 xsi:type="xsd:string">0 xsi:type="xsd:string">Greenstone [68] => Hill, [69] => Kempton [70] => Park, [71] => Gauteng, [72] => South [73] => Africa xsi:type="xsd:string">25065631 xsi:type="xsd:string">ADNUSN1D5U0135477 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">115687485 xsi:type="xsd:string">HG07DKGP xsi:type="xsd:string">2020-07-01 [80] => 08:02:56+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.130168 xsi:type="xsd:double">28.159369 xsi:type="xsd:string">0 xsi:type="xsd:string">Diaz [86] => Avenue, [87] => Eastleigh, [88] => Edenvale, [89] => Gauteng, [90] => South [91] => Africa xsi:type="xsd:string">53844088 xsi:type="xsd:string">ADNUSN2D5U0135485 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">116851782 xsi:type="xsd:string">HH65MRGP xsi:type="xsd:string">2020-07-01 [98] => 06:46:10+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.19221 xsi:type="xsd:double">28.226617 xsi:type="xsd:string">0 xsi:type="xsd:string">Pretoria [104] => Road, [105] => Witfield, [106] => Boksburg, [107] => Gauteng, [108] => South [109] => Africa xsi:type="xsd:string">35613090 xsi:type="xsd:string">ADNUSN1D5U0139460 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">124523243 xsi:type="xsd:string">HM02SRGP xsi:type="xsd:string">2020-07-01 [116] => 07:35:45+02 xsi:type="xsd:string"> xsi:type="xsd:double">-25.75936 xsi:type="xsd:double">28.377471 xsi:type="xsd:string">0 xsi:type="xsd:string">Close [122] => to [123] => Mamelodi, [124] => Gauteng, [125] => South [126] => Africa xsi:type="xsd:string">72339064 xsi:type="xsd:string">ABNALGD22ZR114138 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">124523364 xsi:type="xsd:string">HL98BLGP xsi:type="xsd:string">2020-07-01 [133] => 08:04:54+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.111563 xsi:type="xsd:double">28.130599 xsi:type="xsd:string">98 xsi:type="xsd:string">Eastern [139] => Bypass, [140] => Lombardy [141] => East, [142] => Johannesburg, [143] => Gauteng, [144] => South [145] => Africa xsi:type="xsd:string">41388033 xsi:type="xsd:string">ADNUSN1D5U1046692 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">131644752 xsi:type="xsd:string">DZ04YCGP xsi:type="xsd:string">2020-07-01 [152] => 07:12:08+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.058652 xsi:type="xsd:double">27.9626 xsi:type="xsd:string">0 xsi:type="xsd:string">Sharonlea [158] => & [159] => Exts, [160] => Randburg, [161] => Gauteng, [162] => South [163] => Africa xsi:type="xsd:string">99787541 xsi:type="xsd:string">ADNUSN1DSU018112 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">131928943 xsi:type="xsd:string">CM63CKGP xsi:type="xsd:string">2020-07-01 [170] => 08:04:23+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.091137 xsi:type="xsd:double">28.136977 xsi:type="xsd:string">5 xsi:type="xsd:string">Reid [176] => Avenue, [177] => Linbro [178] => Park [179] => AH, [180] => Sandton, [181] => Gauteng, [182] => South [183] => Africa xsi:type="xsd:string">127659623 xsi:type="xsd:string">ADNUSN1D5U0062513 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">131929103 xsi:type="xsd:string">CW94GBGP xsi:type="xsd:string">2020-07-01 [190] => 07:45:08+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.121185 xsi:type="xsd:double">28.037383 xsi:type="xsd:string">0 xsi:type="xsd:string">Zandfontein [196] => 42 [197] => IR [198] => Ext [199] => 42, [200] => Sandton, [201] => Gauteng, [202] => South [203] => Africa xsi:type="xsd:string">90508868 xsi:type="xsd:string">ADNUSN1D5U0072740 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">131929189 xsi:type="xsd:string">DJ17CSGP xsi:type="xsd:string">2020-07-01 [210] => 08:02:23+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.037962 xsi:type="xsd:double">28.115413 xsi:type="xsd:string">0 xsi:type="xsd:string">Auston [216] => View, [217] => Midrand, [218] => Gauteng, [219] => South [220] => Africa xsi:type="xsd:string">133138296 xsi:type="xsd:string">ADNUSN1D5U0083443 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">133862270 xsi:type="xsd:string">HR66YXGP xsi:type="xsd:string">2020-07-01 [227] => 08:03:59+02 xsi:type="xsd:string"> xsi:type="xsd:double">-29.525639 xsi:type="xsd:double">31.204625 xsi:type="xsd:string">0 xsi:type="xsd:string">Deepdene, [233] => Ballito, [234] => KwaZulu-Natal, [235] => South [236] => Africa xsi:type="xsd:string">65364399 xsi:type="xsd:string">ADNALGD22ZR115154 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">146454559 xsi:type="xsd:string">HV78BLGP xsi:type="xsd:string">2020-07-01 [243] => 07:34:51+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.085404 xsi:type="xsd:double">28.133489 xsi:type="xsd:string">0 xsi:type="xsd:string">Clulee [249] => Road, [250] => Linbro [251] => Park [252] => AH, [253] => Sandton, [254] => Gauteng, [255] => South [256] => Africa xsi:type="xsd:string">30852771 xsi:type="xsd:string">ADNUSN1DSU0156147 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">152773681 xsi:type="xsd:string">HX90JJGP xsi:type="xsd:string">2020-06-30 [263] => 17:52:53+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.130205 xsi:type="xsd:double">28.15951 xsi:type="xsd:string">0 xsi:type="xsd:string">Diaz [269] => Avenue, [270] => Eastleigh, [271] => Edenvale, [272] => Gauteng, [273] => South [274] => Africa xsi:type="xsd:string">14419677 xsi:type="xsd:string">ADNUSN1D5U0161101 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">159833291 xsi:type="xsd:string">JB31BYGP xsi:type="xsd:string">2020-07-01 [281] => 07:17:59+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.181345 xsi:type="xsd:double">28.216789 xsi:type="xsd:string">1 xsi:type="xsd:string">Jet [287] => Park [288] => Road, [289] => Witfield, [290] => Boksburg, [291] => Gauteng, [292] => South [293] => Africa xsi:type="xsd:string">30900017 xsi:type="xsd:string">ADNUSN1D5U0164185 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">167023369 xsi:type="xsd:string">HZ14SDGP xsi:type="xsd:string">2020-07-01 [300] => 08:01:53+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.13017 xsi:type="xsd:double">28.159555 xsi:type="xsd:string">0 xsi:type="xsd:string">Lucas [306] => Road, [307] => Eastleigh, [308] => Edenvale, [309] => Gauteng, [310] => South [311] => Africa xsi:type="xsd:string">17826940 xsi:type="xsd:string">KMFZB7LKU621919 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">167435050 xsi:type="xsd:string">JH04HZGP xsi:type="xsd:string">2020-07-01 [318] => 07:32:35+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.058647 xsi:type="xsd:double">27.961838 xsi:type="xsd:string">0 xsi:type="xsd:string">Sharonlea [324] => & [325] => Exts, [326] => Randburg, [327] => Gauteng, [328] => South [329] => Africa xsi:type="xsd:string">26932527 xsi:type="xsd:string">ADNAPGD222R123234 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">174261628 xsi:type="xsd:string">FF98ZWGP xsi:type="xsd:string">2020-07-01 [336] => 08:04:03+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.129867 xsi:type="xsd:double">28.164617 xsi:type="xsd:string">15 xsi:type="xsd:string">Erasmus [342] => Avenue, [343] => Eden [344] => Glen, [345] => Edenvale, [346] => Gauteng, [347] => South [348] => Africa xsi:type="xsd:string">110330236 xsi:type="xsd:string">ADNU5N1D5U0112998 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">174261922 xsi:type="xsd:string">JG94XXGP xsi:type="xsd:string">2020-06-30 [355] => 13:49:51+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.130232 xsi:type="xsd:double">28.159559 xsi:type="xsd:string">0 xsi:type="xsd:string">Diaz [361] => Avenue, [362] => Eastleigh, [363] => Edenvale, [364] => Gauteng, [365] => South [366] => Africa xsi:type="xsd:string">24696958 xsi:type="xsd:string">ADNUSN1D5U0174093 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">174262077 xsi:type="xsd:string">FX50RTGP xsi:type="xsd:string">2020-07-01 [373] => 08:03:26+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.08572 xsi:type="xsd:double">28.133629 xsi:type="xsd:string">0 xsi:type="xsd:string">Clulee [379] => Road, [380] => Linbro [381] => Park [382] => AH, [383] => Sandton, [384] => Gauteng, [385] => South [386] => Africa xsi:type="xsd:string">108068376 xsi:type="xsd:string">ADNSUN1D5U0128530 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">176362877 xsi:type="xsd:string">FJ14LJGP xsi:type="xsd:string">2020-07-01 [393] => 08:02:22+02 xsi:type="xsd:string"> xsi:type="xsd:double">-26.111907 xsi:type="xsd:double">28.151657 xsi:type="xsd:string">0 xsi:type="xsd:string">Willow [399] => Way, [400] => Greenstone [401] => Hill, [402] => Kempton [403] => Park, [404] => Gauteng, [405] => South [406] => Africa xsi:type="xsd:string">85623895 xsi:type="xsd:string">ADNUSN1D5U0115408 xsi:type="tns:get_vehicle_last_positionsResultType0Row"> xsi:type="xsd:string">176819319 xsi:type="xsd:string">JL90NYGP xsi:nil="true" [413] => xsi:type="xsd:string"/> xsi:type="xsd:string"> xsi:nil="true" [416] => xsi:type="xsd:double"/> xsi:nil="true" [418] => xsi:type="xsd:double"/> xsi:nil="true" [420] => xsi:type="xsd:string"/> xsi:nil="true" [422] => xsi:type="xsd:string"/> xsi:nil="true" [424] => xsi:type="xsd:string"/> xsi:type="xsd:string">ASNUSN1DSU0175716 ) How di i get this into a format to import into mysql [LIST=1] CSV File Reading Displaying CSV file: Clicking the Show Logfile.txt link at the top of the page should display the CSV records inside logfile.txt Displaying CSV records formatted : Clicking the Show logfile.txt Formatted should display the CSV records formatted in an HTML table is descending order (more recent records are at the top). Use this function to convert CSV records back to an array : fgetcsv() I have most of this done and the problem I'm having is trying to read what I put into the file. (I hard coded what should go into the file). Could you tell me what I'm doing wrong and what I should do to fix it? Code: [Select] <? if ($_POST['_act'] = 'csv'): $fp = fopen('logfile.txt', 'a'); while (($data = fgetcsv($fp, 1000, ",")) !== FALSE){ print_r($data); } fclose($fp); endif; if ($_SERVER['REQUEST_METHOD'] == 'POST'): if (empty($_POST['fullname'])): $errMsg['fullname'] = "Please fill in Your Full Name."; endif; if (ereg("'Mr\. '", $_POST['fullname']) == false): $errMsg['fullname'] = "Please fill in Your Full Name."; endif; print_r($errMsgs); echo count($errMsgs); if (count($disperrMsgs > 0)): $dispErrMsgs = true; else: $fp = fopen('logfile.txt', 'a'); $fputcsv($fp, array("test", "lol", "roool")); fclose($fp); $dispSuccessMsg = true; endif; endif; ?> <html> <head> <style type="text/css"> h1 {color:red} div.error {border: 1px solid red; margin: 20px; padding: 20px; width: 400px} table {border: 1px solid #CCC; margin: 20px; border-collapse: collapse;} td, th {border: 1px solid #DDD; padding: 2px} th {background-color:#363; color: white} td.error {color:red} div.success {border: 1px solid green; margin: 20px; padding: 20px; width: 400px; color:green} </style> </head> <body> <h1> Form Validation Lab with Reg Expressions </h1> <p><a href="<?= $_SERVER['PHP_SELF'] ?> ">Refresh This Page</a> | <a href="./logfile.txt">Show Logfile.txt</a> | <a href="<?= $_SERVER['PHP_SELF'] ?>?_act=csv">Show logfile.txt Formatted</a> <a href="<?= $_SERVER['PHP_SELF'] ?>?_act=clear">Clear logfile.txt </a></p> <? if ($dispErrMsgs): ?> <div class="error"> <p>There are errors in the code: </p> <ol> <? foreach($errMsg as $errMsgs ): ?> <li><?= $errMsgs ?></li> <? endforeach; ?> </ol> </div> <? endif; ?> <? if ($dispSuccessMsg): ?> <div class="success"> <p>Thank you for your submission. </p> </div> <? endif; ?> <form action="<?= $_SERVER['PHP_SELF'] ?>" name="getstuff" method="post" > <input type="hidden" name="_act" value="post"> <table cellspacing = "0"> <tr> <th width="78">Full Name:</th> <td width="184"><input name="fullname" type="text" class="textbox" value="<? $_POST['fullname']; ?>" size="20" ></td> <td width="626" >Salution of Mr. or Mrs. followed by two text strings separated by any number of spaces. </td> </tr> <tr> <th>Street:</th> <td><input name="street" type="text" class="textbox" value="<? $_POST['street']; ?>" size="30"></td> <td >2 or 3 digit number followed by a text string ending with Street or Road separated by any number of spaces. </td> <tr> <th>Phone:</th> <td><input name="phone" type="text" class="textbox" value="<? $_POST['phone']; ?>" size="20"></td> <td >10 digits, first 3 digits have optional parentheses, either side of digits 456 are optional space, dot or hyphen. </td> </tr> <tr> <th>PostalCode:</th> <td><input name="postcode" type="text" class="textbox" value="<? $_POST['postcode']; ?>" size="8" maxlength="8"></td> <td > Postal Code: Char Char Digit Hyphen/space Char Digit Digit (No XYZ or 0's. Case insensitive. )</td> </tr> <tr> <th>Email:</th> <td><input name="email" type="text" class="textbox" value="<? $_POST['email']; ?>" size="25" maxlength="40"></td> <td > Must accept as a minimum : a@b.com</td> </tr> </table> <input name="reset" type='button' class="button" value='RESET' onClick="location.href = location.href"> <input name="_submit" type="submit" class="button" value="Submit me now!!!" > </form> <p id="notice">Everything below here is for testing purposes Don't remove this from your lab as I will use these buttons to fill your form with good and bad data as I mark it.</p> <script> az=document.getstuff; function goodstuff(){ az.fullname.value=" Mr. Joe Smith "; az.street.value="135 Fennell Road "; az.phone.value="905-575.1212"; az.postcode.value="Ln9-T23"; az.email.value="jsmith@gov.ca"; } function goodstuff2(){ az.fullname.value=" Mrs. Josephine Smith "; az.street.value=" 13 Fennell Street"; az.phone.value=" (905)-575.1212 "; az.postcode.value=" Ln9 T23"; az.email.value=" jsmith@gov.ca "; } function badstuff(){ az.fullname.value="Miss Josephine Smith"; az.street.value="1 Somewhere Avenue"; az.phone.value="905575122"; az.postcode.value="Z8N 3T2"; az.email.value="jsmith$gov#ca"; } function badstuff2(){ az.fullname.value=" Joe Smith "; az.street.value=" 1392 Fennell Street"; az.phone.value="[905] 575-1212"; az.postcode.value=" Ly9 T20"; az.email.value=" @jsmith$gov#ca"; } function goodandbad(){ az.fullname.value="Mrs. Joe"; az.street.value=" 135 Fennell Avenue West"; az.phone.value="905:5751212"; az.postcode.value=" L99-T23"; az.email.value=" jsmith@.gov.ca "; } </script> <form> <input type=button class="button" onClick="goodstuff();" value="Fill form with good values " length=100 > <input type=button class="button" onClick="goodstuff2();" value="Fill form with good values 2 " > <input type=button class="button" onClick="badstuff();" value="Fill form with BAD values "> <input type=button class="button" onClick="badstuff2();" value="Fill form with BAD values 2 "> <input type=button class="button" onClick="goodandbad();" value="Fill form with Good and BAD values 2"> <br> </form> </BODY> </HTML> I need PHP script I have test.txt file and content is: Cat Dog Bird PHP must find line 1 and line 3 and show up in browser. Cat Bird Eng not good but I hope you understand me. Very thanks. First of all I have no idea how to do this. But I know it can be done. A little help would be alot for me. Thank you in advance. So I want to go through a sitemap and visit each of the link on the sitemap and save the URL on to a database. Example: Quote HP 5550N A3 Colour Laser Printer Konica Minolta PagePro 1350W A4 Mono Laser Printer HP 9050dn A3 Mono Laser Printer HP 5550DTN A3 Colour Laser Printer HP 5550HDN A3 Colour Laser Printer HP 5550DN A3 Colour Laser Printer Lets say this was on the sitemap and it just continues with other product like this. I want to write a code where it will go to the first link and saves the product URL on to the database and continues to do the same until the last link. On my example it would be HP 5550DN A3 Colour Laser Printer. Any help??? Any ideas?? I am not asking someone to write the code for me.. Just need help and good direction how can I make php read a file with ids in the format 23423423 32423423 23423454 56667777 and output each id to $id[]? I have been uploading a file via a php script and DBing the file name into a table. All of a sudden, the user starts to get this when trying to write the file name to the table. Table 'files' is read only apparently it works sometimes and then other times, the user gets the message above. anyone have this issue before. Hey Guys, I have a JS script for booking time slots for a delivery. On the same page I have the payment system etc, so I'm just wondering how would i read the selected options from the JS and input it into the order details on in the PHP system. The booking system is loaded by calling Code: [Select] <script language="javascript" src="/booking/load.php?view=2&cid=1"></script> Contents of Load.php Code: [Select] <?php error_reporting(0); include("options.php"); if (!isset($_REQUEST["cid"])) { $calendarId = '1'; } else { $calendarId = $_REQUEST["cid"]; }; if (!isset($_REQUEST["view"])) { $view = '1'; } else { $view = $_REQUEST["view"]; }; $sql = "SELECT * FROM ".$TABLES["Calendars"]." WHERE id='".$_REQUEST["cid"]."'"; $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); $Calendar = mysql_fetch_assoc($sql_result); $CalendarOptions = unserialize($Calendar["options"]); $loadCalendar = ' <div id="AvailabilityCalendar'.$_REQUEST["cid"].'"></div> <div id="DateBookings'.$_REQUEST["cid"].'" style="margin:0px; padding:0px"></div> <script language="javascript"> ajaxpage("'.$SETTINGS["installFolder"].'load-calendar.php?view='.$view.'&cid='.$calendarId.'","AvailabilityCalendar'.$_REQUEST["cid"].'","get"); </script> '; $loadCalendar = preg_replace("/\n/","",$loadCalendar); $loadCalendar = preg_replace("/\r/","",$loadCalendar); ?> var flagCaptcha = false; var flagFields = true; var maxSlots=<?php echo $CalendarOptions["bookingLenght"]; ?>; var message = 'Please fill in all mandatory fields ! \n'; var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no) var bustcacheparameter=""; function checkForm() { all_inputs=document.getElementsByTagName("input"); for (i=0;i<all_inputs.length;i++) { if (all_inputs[i].type=="checkbox") { if ((all_inputs[i].checked)&&(! all_inputs[i].disabled)) { return true; } } } alert("Select at least 1 time slot"); return false; } function selectTimeSlot() { disableElements(); singlePrice=document.getElementById("singlePrice").value; price=0; all_inputs=document.getElementsByTagName("input"); for (i=0;i<all_inputs.length;i++) { if (all_inputs[i].type=="checkbox") { if ((all_inputs[i].checked)&&(! all_inputs[i].disabled)) { price=parseFloat(price)+parseFloat(singlePrice); } } } document.getElementById("price").value=price; document.getElementById("priceDiv").innerHTML=price; } function disableElements() { first=-1; last=-1; emptySpot=false; all_inputs=document.getElementsByTagName("input"); for (i=0;i<all_inputs.length;i++) { if (all_inputs[i].type=="checkbox") { if ((all_inputs[i].checked)&&(! all_inputs[i].disabled)) { if (emptySpot) { all_inputs[i].checked=false; } else { if (first<0) { first=i; last=i; } if ((i-last)>1) { all_inputs[i].checked=false; emptySpot=true; } else { last=i; } } } } } if ((last-first+1)==maxSlots) { reachedMax=1; } else { reachedMax=0; } if (first>=0 && last>=0) { for (i=0;i<all_inputs.length;i++) { if (all_inputs[i].type=="checkbox") { if ((i<(first-(1-reachedMax))) || (i>(last+(1-reachedMax)))) { if ((! all_inputs[i].checked) && (! all_inputs[i].disabled)) { all_inputs[i].disabled=true; } } else { if ((! all_inputs[i].checked)) { all_inputs[i].disabled=false; } } } } } else { for (i=0;i<all_inputs.length;i++) { if (all_inputs[i].type=="checkbox") { if ((! all_inputs[i].checked)) { all_inputs[i].disabled=false; } } } } } function createRequestObject(){ try { xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert('Sorry, but your browser doesn\'t support XMLHttpRequest.'); }; return xmlhttp; }; function ajaxpage(url, containerid, requesttype){ var page_request = createRequestObject(); if (requesttype=='get'){ if (bustcachevar) bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime() page_request.open('GET', url+bustcacheparameter, true) page_request.send(null) } else if (requesttype=='post') { page_request.open('POST', url, true); page_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); page_request.setRequestHeader("Content-length", poststr.length); page_request.setRequestHeader("Connection", "close"); page_request.send(poststr); }; page_request.onreadystatechange=function(){ loadpage(page_request, containerid) } } function ShowToolTip(object) { document.getElementById(object).style.visibility = 'visible'; } function HideToolTip(object) { document.getElementById(object).style.visibility = 'hidden'; } function loadpage(page_request, containerid){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) { document.getElementById(containerid).innerHTML=page_request.responseText; }; } function submitDate(date) { ajaxpage("<?php echo $SETTINGS["installFolder"];?>load-calendar.php?perDay="+date+"&view=<?php echo $view; ?>&cid=<?php echo $calendarId; ?>","AvailabilityCalendar<?php echo $_REQUEST["cid"]; ?>","get"); } function submitBooking(startdate,sMonth,sYear) { var poststr = "ac=book&startDate="+startdate+"&customerName=" + encodeURIComponent( document.frm.customerName.value ) + "&email=" + encodeURIComponent( document.frm.email.value ) + "&phone=" + encodeURIComponent( document.frm.phone.value ) + "¬es=" + encodeURIComponent( document.frm.notes.value ) + "&price=" + encodeURIComponent( document.frm.price.value ); alert(poststr); all_inputs=document.getElementsByTagName("input"); for (i=0;i<all_inputs.length;i++) { if (all_inputs[i].type=="checkbox") { if ((all_inputs[i].checked)&&(! all_inputs[i].disabled)) { poststr=poststr+"&"+parseInt(all_inputs[i].id)+"=on"; } } } ajaxpage('<?php echo $SETTINGS["installFolder"]; ?>load-bookingform.php?ac=book&cid=<?php echo $_REQUEST["cid"]; ?>&'+poststr,'DateBookings<?php echo $_REQUEST["cid"]; ?>','get'); var start = new Date().getTime(); while (new Date().getTime() < start + 500); ajaxpage('<?php echo $SETTINGS["installFolder"].'load-calendar.php?view='.$view; ?>&cid=<?php echo $_REQUEST["cid"]; ?>&month='+sMonth+'&year='+sYear,'AvailabilityCalendar<?php echo $_REQUEST["cid"]; ?>','get'); }; loadCalendar = '<?php echo $loadCalendar; ?>'; document.writeln(loadCalendar); Any ideas? |