Jump to content

frobak

Members
  • Posts

    96
  • Joined

  • Last visited

About frobak

  • Birthday 02/23/1977

Contact Methods

  • Website URL
    http://www.enetdesign.co.uk

Profile Information

  • Gender
    Male
  • Location
    Milton Keynes

frobak's Achievements

Member

Member (2/5)

0

Reputation

  1. in my stupidity, i neglegted to try it in different browsers. It works in chrome and safari, but i was trying it firefox, and even more stupidly I didnt look at the errors. As its over ssl, im having issues linking to offsite js files that are hosted over http. I'm getting mixed content errors. I'll try hosting all the files and see if that works. Appreciate your help
  2. Hi .Josh Yes its very strange. If i visit stream.php the video plays. I am now not using the below, as I was trying to just echo the URL within the player code, but as its outside the root, i cant access it like that: $file_stream_url = "../users/$u_id/$folder_name/$file_name"; For now I have hard coded the path into stream.php just to try and get it working, hard coded path below: $path='/home/[account_name]/users/100002/Testage/marine.mp4'; And i have also tried $path='../users/100002/Testage/marine.mp4'; they both stream the video fine if you visit stream.php, but doesnt work when i try to access it via: echo <<<EOT <div id="video_box"> <video id="example_video_1" class="video-js vjs-default-skin" controls preload="auto" width="500" height="350" poster="images/img_splash.png" data-setup='{"example_option":true}'> <source src='https://url_to_file/stream.php' type='$file_type' /> </video> </div> <div id='video_details'> <div id='video_details_text'> <h2>Download this video</h2> <p>To download this video, click the download button.<br /><br />Depending on the format of the file, you may need to download the player <a href=''>here</a></p> </div> <div id="video_details_dl"> <form method='POST' action='functions.php'> <input type='hidden' id='download_url' name='download_url' value='$file_url'> <input type='hidden' id='download_type' name='download_type' value='$file_type'> <input type='submit' class='file_download_button clickable' name='submit' value='Download'> </form> </div> </div> EOT;
  3. I tried using readfile, this is my player: <div id='video_box'> <video id='example_video_1' class='video-js vjs-default-skin' controls preload='auto' width='500' height='350' poster='images/img_name.png' data-setup='{'example_option':true}'> <source src='https://url_to_file/stream.php' type='video/mp4' /> </video> </div> and the content of the file https://url_to_file/stream.php: <?php $path='../users/100002/Testage/marine.mp4'; header('Content-type: video/mp4'); header('Content-Length: '.filesize($path)); // provide file size readfile($path); ?> but it doesnt do anything, the player says "No video with supported format and MIME type found" and when i look at the source it is just printing the url https://url_to_file/stream.php. If i visit the url above, it streams the video, but obviously not in the player Am i missing something simple?
  4. ok thank for your reply. Currently I am using video.js (html5 player) to stream the files. Which worked when the files were within the root, but since ive moved them out, it doesnt work. The file url is held in a var : $file_stream_url = "../users/$u_id/$folder_name/$file_name"; and the code to stream: <div id="video_box"> <video id="example_video_1" class="video-js vjs-default-skin" controls preload="auto" width="500" height="350" poster="images/img_name.png" data-setup='{"example_option":true}'> <source src="$file_stream_url" type='$file_type' /> </video> </div> Is it possible to use this script, or do i need to rewrite?
  5. Hi, before i get burried in trying to create the code, I was hoping to get some advice before moving forward. I am creating a video sharing app for a client. The videos are highly confidential, so i want to store them outside the root and stream them when a user enters a link into a browser. Is this possible? I can seem to find any info on any forums or Google. Can I stream it direct to the browser? Many thanks Alan
  6. Well i finally figured it out. I took what you said and explored the xml because it was working when we put static xml in the variable. And after many hours of debugging i finally realised that the xml response i posted above, the tag name of the xml element was actually 'PartNumber' not 'partnumber'. I copied the above from firebug, which stupidly makes everything lower case. So i just changed the regex to: $regex[] = '/.*?<PartNumber>/s'; Thanks MMDE for your patience and help on this, otherwise i'd still be in the dark. peace out
  7. Yes i only need the part number thanks but that doesnt return anything?! $result = curl_exec($ch); $xml = $result; $regex[] = '/.*?<partnumber>/s'; $regex[] = '/<.*/s'; echo preg_replace($regex, '', $xml); var_dump($regex); array(2) { [0]=> string(18) "/.*?/s" [1]=> string(6) "/<.*/s" } also tried this: $part_no = preg_replace($regex, '', $xml); var_dump($part_no); string(0) ""
  8. yeah that doesnt work, the $part variable hasnt got anything in it, as below. $dom = new DomDocument("1.0", "ISO-8859-1"); $dom->loadXML($result); $part = $dom->getElementsByTagName('partnumber')->item(0)->value; But i know that the xml that i have listed above is in $result So why is so difficult to get to that element in the xml?
  9. yes, unfortunately ive spent many hours on php.net, where the info is usually very technical for someone that is learning.
  10. Hi Im trying to get the contents of a domdocument element. I need to get to the 'partnumber' of the below xml response from the soap request. can you tell me if this object has some values in it? object(DOMNodeList)#3 (1) { ["length"]=> int(0) } This is the xml <soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <vehicle_getvehicleandcomponentpartsresponse xmlns="http://tempuri.org/"> <vehicle_getvehicleandcomponentpartsresult> <xs:schema id="NewDataSet" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns=""> <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <newdataset xmlns=""> <stddata msdata:roworder="0" diffgr:id="StdData1"> <make>CITROEN </make> <model>C3 SX </model> <cc>01360</cc> <vin>blah</vin> <engine_number>blah</engine_number> <reg_date>29-SEP-2002</reg_date> <manuf_date>29-SEP-2002</manuf_date> <colour>BLUE</colour> <fuel>PETROL</fuel> 5 DOOR HATCHBACK <co2>148</co2> <vehicle_gross_weight>0000000</vehicle_gross_weight> <imported>0</imported> <imported_date>01-JAN-0001</imported_date> <scrapped_date>01-JAN-0001</scrapped_date> <scrapped>0</scrapped> <unscrapped>0</unscrapped> <vehicle_max_tech_mass>00000</vehicle_max_tech_mass> <vehicle_max_power>000</vehicle_max_power> <vehicle_mass>000001080</vehicle_mass> <vehicle_seats>000</vehicle_seats> <wheelplan_desc>2 AXLE RIGID BODY</wheelplan_desc> <dvla_engine_code>KFV</dvla_engine_code> <vin_build_year>N/A</vin_build_year> <vin_build_month>N/A</vin_build_month> </stddata> <enhanceddata msdata:roworder="0" diffgr:id="EnhancedData1"> <fldmanlname>Citroen</fldmanlname> <fldmodlname>C3</fldmodlname> <fldmodverno>1A (4/2002 - 9/2005)</fldmodverno> <fldmanvercode>FC</fldmanvercode> <fldderlname>SX</fldderlname> <fldderverno>1A (4/2002 - 9/2005)</fldderverno> <fldspecdes> <fldstrgposlname>Right Hand Drive</fldstrgposlname> <fldstrgpossname>RHD</fldstrgpossname> <fldbstlname>Hatchback</fldbstlname> <fldbstsname>Hat</fldbstsname> <flddoocountlname>5 Doors</flddoocountlname> <flddoocountsname>5 drs</flddoocountsname> <fldseacountlname>5 Seats</fldseacountlname> <fldseacountsname>5 Seats</fldseacountsname> <flddrivetypelname>Front</flddrivetypelname> <flddrivetypesname>FWD</flddrivetypesname> <fldtratypelname>Manual</fldtratypelname> <fldtratypesname>Man</fldtratypesname> <fldgeacountlname>5 Gears</fldgeacountlname> <fldgeacountsname>5 gr</fldgeacountsname> <fldengsizelname>1.4 litres</fldengsizelname> <fldexactcc>1360</fldexactcc> <fldfuelname>Petrol</fldfuelname> <fldfuesname>Pet</fldfuesname> <fldfudlname>Injection</fldfudlname> <fldfudsname>Inj</fldfudsname> <fldvalcountlname>8 Valves</fldvalcountlname> <fldvalcountsname>8V</fldvalcountsname> <fldbhp>75</fldbhp> <fldkw>55</fldkw> <fldenginecode>KFV</fldenginecode> <fldgearboxcode> <fldcylcountlname>4 Cylinders</fldcylcountlname> <fldcylcountsname>4 Cyl</fldcylcountsname> <fldcamshaftlname>SOHC</fldcamshaftlname> <fldengalignlname>Transverse</fldengalignlname> <fldengalignsname>Trans</fldengalignsname> <fldcylconfigurationlname>Inline</fldcylconfigurationlname> <fldcylconfigurationsname>Inline</fldcylconfigurationsname> <fldengposlname>Front</fldengposlname> <fldengpossname>Frt</fldengpossname> <fldaxllname>4x2</fldaxllname> <fldaxlsname>4x2</fldaxlsname> <fldwheelbaselname>2460mm</fldwheelbaselname> <fldweilname>1470kg</fldweilname> <fldspec2des> <fldvehtypedes>Car</fldvehtypedes> <fldmfrcolour>Mauritius Blue,Oriental Blue,Tuscan Blue</fldmfrcolour> <fldspec2id>1226</fldspec2id> </fldspec2des> </fldgearboxcode> </fldspecdes> </enhanceddata> <parts msdata:roworder="0" diffgr:id="Parts1"> <imagepath>http://topcat.adsapplications.co.uk/ImageStore/no_image.png</imagepath> <supplierid>1992</supplierid> <supplier>UK Reference</supplier> <partnumber>202</partnumber> and this is the php code im trying $dom = new DomDocument("1.0", "ISO-8859-1"); $dom->loadXML($result); $xpath = new DomXPath($dom); $queryResult = $xpath->query('/parts[@id="Parts1"]/partnumber'); $node = $queryResult->item(0); echo "{$node->nodeName} - {$node->nodeValue}"; SO if there is somethign in the object, how would i get to it? or id the object empty? What do you think?
  11. Hi, i'm trying to access parts of this soap response xml, but I just cant get it. I dont understand the diffgram bit for a start. And do i need to think about the soap and vehicle_getvehicleandcomponentpartsresponse namespaces? I need the partnumber! Heres the xml <soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <vehicle_getvehicleandcomponentpartsresponse xmlns="http://tempuri.org/"> <vehicle_getvehicleandcomponentpartsresult> <xs:schema id="NewDataSet" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns=""> <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <newdataset xmlns=""> <stddata msdata:roworder="0" diffgr:id="StdData1"> <enhanceddata msdata:roworder="0" diffgr:id="EnhancedData1"> <parts msdata:roworder="0" diffgr:id="Parts1"> <imagepath>http://topcat.adsapplications.co.uk/ImageStore/no_image.png</imagepath> <supplierid>1992</supplierid> <supplier>UK Reference</supplier> <partnumber>202</partnumber> I'm using curl, and the php code im trying: $result = curl_exec($ch); $enhanced_data = new SimpleXMLElement($result); $bat_part = $enhanced_data->children('diffgr', true)->children()->NewDataSet->Parts->partumber; I know this is wrong, but i have accessed similar data from a similar service, the only difference is the below soap response: <soap:envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <vehicle_getvehicleandcomponentpartsresponse xmlns="http://tempuri.org/"> <vehicle_getvehicleandcomponentpartsresult> Surely this shouldnt be so difficult, am i doing somethign completely wrong?
  12. Hi I am tryign to connect to a web service through curl. I need to send a soap header with user/pass details, and then send the request with a further var and user/pass. I've been mucking around with this for ages now and need some help if possible. Im getting error "Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected, '<' not found" I assume because its not returning xml, but even when i try to just print the respose without using simpleXMLelement i get an error about data is invalid. The code should return xml This is the code i have: // capture vehicle registration from main script $vehicle_reg = $_POST['add_vehicle_reg']; // convert reg to uppercase, remove spaces $vehicle_reg = strtoupper($vehicle_reg); $vehicle_reg = str_replace(' ', '', $vehicle_reg); define('NEWLINE', "<br />\n"); $ch = curl_init(); $data = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <ServiceAuthHeader xmlns="http://example.com/"> <Username>username</Username> <Password>password</Password> </ServiceAuthHeader> </soap:Header> <soap:Body> <Vehicle_GetVehicleAndComponentParts xmlns="http://hosturl.com"> <vrm>' . $vehicle_reg . '</vrm> <userName>username</userName> <encryptedPassword>password</encryptedPassword> </Vehicle_GetVehicleAndComponentParts> </soap:Body> </soap:Envelope>'; curl_setopt($ch, CURLOPT_URL, 'http://www.example.com'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 1st REQUEST $postresponse = curl_exec ($ch); $veh_make = new SimpleXMLElement($postresponse); curl_close($ch); Am i like, miles away. Should i go back to school?
  13. Hey Right, have this issue with accessing simpleXML elements, i'm sure it should work, but i cant seem to get it. This is the xml data. I need the model and make: <diffgr:diffgram> <NewDataSet> <StdData diffgr:id="StdData1" msdata:rowOrder="0"> <MAKE>CITROEN</MAKE> <MODEL>C3 SX</MODEL> here is the php ive got: $xml->children("diffgr", true)->diffgram->children("")->NewDataSet->StdData->MAKE; Can you see where im going wrong? cheers
  14. Thanks, that done the trick appreciate your help
  15. Hi, having some issues getting to the values of an xml document using simplexmlelement Basically, whatever i do, i cant seem to get the values heres the xml data <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="StdData"> <xs:complexType> <xs:sequence> <xs:element name="MAKE" type="xs:string" minOccurs="0" /> <xs:element name="MODEL" type="xs:string" minOccurs="0" /> <xs:element name="CC" type="xs:string" minOccurs="0" /> <xs:element name="VIN" type="xs:string" minOccurs="0" /> <xs:element name="ENGINE_NUMBER" type="xs:string" minOccurs="0" /> <xs:element name="REG_DATE" type="xs:string" minOccurs="0" /> <xs:element name="MANUF_DATE" type="xs:string" minOccurs="0" /> <xs:element name="COLOUR" type="xs:string" minOccurs="0" /> <xs:element name="VEHICLE_MASS" type="xs:string" minOccurs="0" /> <xs:element name="VEHICLE_SEATS" type="xs:string" minOccurs="0" /> <xs:element name="VEHICLE_V5c_DATE" type="xs:string" minOccurs="0" /> <xs:element name="VEHICLE_NOISE_STATIONARY" type="xs:string" minOccurs="0" /> <xs:element name="VEHICLE_NOISE_DRIVE_BY" type="xs:string" minOccurs="0" /> <xs:element name="VEHICLE_NOISE_ENGINE" type="xs:string" minOccurs="0" /> <xs:element name="WHEELPLAN_DESC" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="EnhancedData"> <xs:complexType> <xs:sequence> <xs:element name="fldmanLName" type="xs:string" minOccurs="0" /> <xs:element name="fldmodLName" type="xs:string" minOccurs="0" /> <xs:element name="fldmodverNo" type="xs:string" minOccurs="0" /> <xs:element name="fldderLName" type="xs:string" minOccurs="0" /> <xs:element name="fldderverno" type="xs:string" minOccurs="0" /> <xs:element name="fldbstLName" type="xs:string" minOccurs="0" /> <xs:element name="flddooCountLName" type="xs:string" minOccurs="0" /> <xs:element name="fldgeacountLname" type="xs:string" minOccurs="0" /> <xs:element name="fldtratypeLname" type="xs:string" minOccurs="0" /> <xs:element name="fldEngineCode" type="xs:string" minOccurs="0" /> <xs:element name="fldGearboxCode" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <NewDataSet xmlns=""> <StdData diffgr:id="StdData1" msdata:rowOrder="0"> <MAKE>CITROEN </MAKE> <MODEL>C3 SX Basically, i need to get the make and model of the car, which is showing just above. heres the php // INIT CURL $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL, ''); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, ''); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 1st REQUEST (LOGIN) $postresponse = curl_exec ($ch); echo $postresponse; // SET FILE TO DOWNLOAD curl_setopt($ch, CURLOPT_URL, ''); // EXECUTE 2nd REQUEST (xml response) $getresponse = curl_exec ($ch); $xml = new SimpleXMLElement($getresponse); echo $xml->diffgram->MAKE; // CLOSE THE SESSION curl_close($ch); ive been trying for a coupel of days now, need some help. how can i access those xml elements only? any ideas cheers
×
×
  • 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.