Jump to content

ankhmor

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Everything posted by ankhmor

  1. Yes i have restarted it. It doesnt work in a way that it loads output only once the whole script is done running.
  2. Hi. I have a problem with output buffering. I'm using wamp. I've tried setting the php.ini file to output_buffering = 0 and off I've tried using flush() and ob_flush(), separetly and together. I've tried turning on implicit_flush. Nothing works. Any ideas? I'm using the flowing code to test right now: echo 'starting...<br/>'; for($i = 0; $i < 5; $i++) { print "$i<br/>"; flush(); sleep(2); } print 'DONE!<br/>';
  3. nah its definitely in the foreach loop. and if it wasn't it would only echo one line instead of hundreds.
  4. I have a script that has a foreach loop. The script ususally runs for VERY VERY long time ( i have set_time_limit(0) Now what I need it to do is to echo some string at the end of each loop. However it doesn't. The script displays everything after its finished. That's not acceptable for me. I'm running xampp for windows.
  5. Hi. The script within beforeSend : doesn't work. Still doesn't work even if I remove sucess: . Any ideas? $(document).ready( function () { $("#form_code").submit(function(){ $("#form_code").css("display", "none"); }) $.ajax({ type: "POST", url: "main.php", data: "password=048478", beforeSend: function { alert( "Data Saved:"); }, success: function(msg){ alert( "Data Saved: " + msg ); } }); });
  6. wrapping everything in document.ready part worked. but is there an alternative?
  7. This is what I load in the head of my index.php <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script src="js_functions.js" type="text/javascript"></script> this is part of index.php <div id="output"> </div> In the js_function.js the following works $(document).ready( function () { alert('The document is ready.'); } ); or $(document).click( function () { alert('The document is ready.'); } ); However the following does not. $("#output").click( function () { alert('The document is ready.'); } );
  8. I was wondering if there was any way that I could pause a php script and then restart it with USER INPUT? Kind of like when you are copying a file to a folder with the same file name and Windows asks you if you want to copy it there. I was also thinking that if above isn't possible, would it be possible to start a curl session in one script (say index.php) and then continue it in another (say curl.php)?
  9. figured it out. for some reason the cookie file was being created in the root directory of xampp and not in the htdocs/path
  10. I tried using $cookie_file_path = "cookie.txt"; $fp = fopen($cookie_file_path,'wb'); fclose($fp); $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7"; $reffer = "http://www.facebook.com/login.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://login.facebook.com/login.php"); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_fie_path); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); curl_setopt($ch, CURLOPT_REFERER, "http://www.facebook.com/login.php"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, "charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&version=1.0&return_session=0&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&email=user%40gmail.com&pass=0000000"); $html = curl_exec($ch); echo $html; but the cookie file is empty and facebook tells me that i don't have cookies enabled. wtf?
  11. I get this Array ( [url] => the page url [content_type] => text/html [http_code] => 200 [header_size] => 476 [request_size] => 153 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.063 [namelookup_time] => 0 [connect_time] => 0.016 [pretransfer_time] => 0.016 [size_upload] => 0 [size_download] => 8447 [speed_download] => 134079 [speed_upload] => 0 [download_content_length] => 8447 [upload_content_length] => -1 [starttransfer_time] => 0.063 [redirect_time] => 0 )
  12. As AbraCadaver stated, you should fix your consistency errors (variables names should stay the same for ex): curl_setopt ($curl_handle, CURLOPT_COOKIEJAR, $tmphandle); curl_setopt ($curl_handle, CURLOPT_COOKIEFILE, $tmphandle); Should be: curl_setopt ($curl_handle, CURLOPT_COOKIEJAR, $tmpfname); curl_setopt ($curl_handle, CURLOPT_COOKIEFILE, $tmpfname); And use integer boolean values (0,1) instead of string boolean (true,false) when defining cURL Options. For example: curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); hope this helps That didn't do the trick actually. Also the part where echo "<!--// Look in page-source (html) to view this properly: \n", print_r($info), "\n //-->\n", $output; in page source $info shows up as 1 and it is before the rest of the page however if i set CURLOPT_RETURNTRANSFER to 0 then i end up with the following on the bottom of page source <!--// Look in page-source (html) to view this properly: 1 //--> 1
  13. I have the following script and I've been trying to make it work for hours $tmpfname = "temp\cookie.txt"; $curl_handle=curl_init(); $user_agent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0)"; curl_setopt($curl_handle,CURLOPT_URL,'url goes here'); curl_setopt($curl_handle, CURLOPT_USERAGENT, $user_agent); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,FALSE); curl_setopt ($curl_handle, CURLOPT_HEADER, TRUE); curl_setopt ($curl_handle, CURLOPT_COOKIEJAR, $tmphandle); curl_setopt ($curl_handle, CURLOPT_COOKIEFILE, $tmphandle); curl_exec($curl_handle); curl_close($curl_handle); } There are 2 problems. 1. the most important is that the cookies don't save. However in the header that i get there's plenty of Set-Cookie: 2. I've set CURLOPT_RETURNTRANSFER to false, however I still see the webpage when I run cURL. I even deleted the portion where I echoed the buffer (I used to have CURLOPT_RETURNTRANSFER set to true). I used to have this portion of the code if (empty($buffer)) { print "Sorry, unable to retrive site.<p>"; } else { print $buffer; } but all the buffer printed out was "1" (without the quotes) Any ideas?
  14. hi. I have a google map in which I load a kml overlay file. Then I need a button on the page itself that could remove the overlay. In google api manual it says to enable the layer you need to do this var georssLayer = new google.maps.KmlLayer('http://api.flickr.com/services/feeds/geo/?g=322338@N20〈=en-us&format=feed-georss'); georssLayer.setMap(map); To DISABLE you need to do this "You can hide a KmlLayer by setting this value to null within the setMap() method." However if I do this on my page <input type="button" value="Remove overlay" onclick="georssLayer.setMap(null)"/> it doesn't work. I'm not really good with javascript. Any help?
  15. so I have an xml string the following expression $xpath = $response->xpath('/atom:feed/atom:entry/atom:content'); returns the following array SimpleXMLElement Object ( [@attributes] => Array ( [type] => application/vnd.google-earth.kml+xml ) [Placemark] => SimpleXMLElement Object ( [name] => M1 [description] => SimpleXMLElement Object ( ) [style] => SimpleXMLElement Object ( [iconStyle] => SimpleXMLElement Object ( [icon] => SimpleXMLElement Object ( [href] => http://maps.gstatic.com/intl/en_ALL/mapfiles/ms/micons/blue-dot.png ) ) ) [Point] => SimpleXMLElement Object ( [coordinates] => -79.395018,43.645423,0.0 ) ) ) However what I'm trying to get are the coordinates, but neither $xpath = $response->xpath('/atom:feed/atom:entry/atom:content/Placemark'); OR $xpath = $response->xpath('/atom:feed/atom:entry/atom:content/Placemark/child::*'); work I even tried just loading atom:content into an array and going from there no luck. Any ideas. Oh. BTW this might help http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html#RetrievingFeatures
  16. Ok So I've researched a bit and now I understand namespaces, but I still cannot access the <coordinate></coordinate> can someone please write an simplexml path of how to get the coordinates? http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html#RetrievingFeatures <atom:content type='application/vnd.google-earth.kml+xml'> <Placemark xmlns="http://www.opengis.net/kml/2.2"> <name>East River Line</name> <description> <![CDATA[A streetcar proposal for New York's Brooklyn and Queens waterfront]]> </description> <Style> <LineStyle> <color>73FF0000</color> <width>5</width> </LineStyle> </Style> <LineString> <tessellate>1</tessellate> <coordinates>-73.872446,40.774481,0.0 ... -74.005537,40.671329,0.0</coordinates> </LineString> </Placemark> </atom:content>
  17. thanks A LOT
  18. ok it does load but how do i read it? i mean $response->atom:entry->id or $response->entry->id doesn't work
  19. How would I calculate if a coordinate lies within a polygon with an indefinite amount of points? If that's really complex math how would I do the same if the polygon had only four points? All using Google Maps. But for this I mostly need the math.
  20. I'm having trouble loading this kind of KML with PHP http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html#RetrievingFeatures example <atom:entry xmlns='http://www.opengis.net/kml/2.2' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gd='http://schemas.google.com/g/2005'> <atom:id> http://maps.google.com/maps/feeds/features/userID/mapID/full/featureID</atom:id> <atom:published>2008-08-14T17:46:06.462Z</atom:published> <atom:updated>2008-08-14T18:12:31.589Z</atom:updated> <atom:category scheme='http://schemas.google.com/g/2005#kind' ..... it seems like the column in atom:entry, etc is causing this. $response = simplexml_load_string($response); print_r($response); the above just gives an empty SimpleXMLElement Object() Any ideas
  21. well i have to double post because no one seems to reply
  22. Is there a thing in drupal that is similar to shortcodes in wordpress? for those who dont know what a shortcode is its just a little string ex. [shortcode] that you insert into a page or post. When the page comes up on the website instead of [shortcode] a php script is ran. thanks
  23. Can I have a page that would automatically be populated with posts from a certain taxonomy group (like if i have a term in a vocabulary called news)? Is it possible to do with Panels module? Or do I have to write my own module? Thanks.
  24. Is there a way to put something like a shortcode in your post or page and then to have that put in a variable? Example: lets say u put [hello yes=5] into a post with the shortcodes right now i would have to write a function that would return something. But is there a way to get this information into a variable? lets say like $hello = array('yes' => 5) or just $hello = 'yes,5'?
  25. thx. its just the phpdesigner puts it there. and for the longest time ever i couldnt figure out y my script wasnt working.
×
×
  • 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.