Jump to content

Akkari

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by Akkari

  1. Hey there everyone, I'm using curl to retrieve webpages and lookup a certain string in their source code. Apparently a lot of websites use 303,304,...etc redirects for various reasons like: redirecting domain.com to www.domain.com redirecting domain.com to domain.com/portal ...etc Now the problem is that when curl hits any kind of redirect, it doesn't "follow" it but simply retrieves the page that has nothing it it except the header redirect and hence fails. Is there any way to make curl "follow" redirects and retrieve the page from where it's supposed to be? Thanks!
  2. Thanks for the input everyone. I managed to solve the issue by changing the test website I was testing the script on. It turned out that the original test website http://site.com had a 3xx redirect to http://www.site.com which made curl fail to retrieve the website. I will open a new topic with that new issue, hopefully someone would be able to point me in the right direction. Thanks!
  3. Thanks a lot for the response guys. @sumpygump The string is "/images/" (without the quotes of course) which occurs within URLs referencing the images folder of the website. So usually it'll occur as part of an image URL displayed on the page. @ManiacDan I think your suggestion might be useful in other situations so I'm looking it up now. However, in this particular situation I echoed out $content and it displayed the target site perfectly. Appreciate your responses, guys!
  4. Hello there everyone, Been a while since I last posted. I've successfully retrieved external HTML pages using Curl, through the following code: $ch = curl_init("http://www.site.com/"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); $content = curl_exec($ch); curl_close($ch); I then tried adding something, which I thought that there certainly has more to it than that but tried it anyway: if(strpos($content,"string_to_search_for") == false) echo "Not found."; else echo "Found."; Now this returned "Not found" every time for me, even if the string was present in that page source code. On a side note, I will be using this to evaluate hundreds, potentially thousands of websites to see if they have that string present in the source code. How long do you think execution time would be for say, a 1000 URL? And would there be a better approach to speed things up? Thanks!
  5. SOLVED! A separate issue has arised so I'm gonna open a new thread. All I simply needed was to use the javascript's unescape(). By the way, I cannot find the mark as solved button. Is it something on my side?
  6. Thanks for your eye opening response and sorry for the late reply. Actually when dumped in PHP it works. However, I think I should add a very important point. The arabic data is gathered through a form and processed through a $_GET. Meaning PHP receives the data from a URL. So all my concentration now is how to decode this: %u064A%u0627%u0633%u064A%u0646 which seemingly is how "arabic" looks in a URL. Thanks a lot.
  7. Hey there everyone. Today isn't my lucky day since I'm dealing with international characters. (Arabic). What happens is the following: Arabic entered in form > saved to MySQL > Retrieved from MySQL > outputted as XML > used in an application (Google maps if it makes any difference). Plain and simple, the problem is that the final output is this: %u0645%u0639%u0644%u0645 which definetly isn't arabic. What I've tried so far: - Loading the Google Maps thing directly from XML which I manually created and put the arabic chars into -> WORKED! (meaning I cut out the saving and retrieval of info from the db to see where the problem may be coming from) - Set the database collation and charset to utf8_unicode_ci. (Also collation of the fields inside the table) -> NO LUCK! - Tried encoding all PHP files and html files involved in the process to UTF-8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -> NO LUCK! - Tried a suggestion from Google which said try to execute this query after connection with the db: mysql_query("SET NAMES 'utf8'"); mysql_query('SET CHARACTER SET utf8'); -> still no luck First time I get that frustrated. I guess the problem isn't with Gmaps and XML. Something to do with PHP & MySQL because when the raw XML files displays correctly, Gmaps works like a charm. And the only way I got the XML file to show correctly as said earlier was to manually create it and enter the arabic text in it. Thanks a lot for any help provided!
  8. Hello there everyone. I'm pretty poor at Javascript but currently working on it. I have a simple question with regards to the current Google Maps javascript API. I'm trying to retrieve locations from MySQL and post them on a map as well as allow the user to enter a new location and store it in the db. So far I think I'm getting my hands on the right stuff. XML to output map: mysql > php > xml > javascript > display on map. In case of storing, javascript sending GET parameters to a PHP script which then parses and stores them in the db. The question is: With a lot of searching I think I found the tutorials that can help me achieve this. However, they are from 2007. This one: http://code.google.com/apis/maps/articles/phpsqlinfo.html and this one: http://code.google.com/apis/maps/articles/phpsqlajax.html These are the only tutorials I could find related to PHP and MySQL. Are they up to date or will they break when I try to implement them? I'm pretty confused with all the materials on code.google.com but found those to be the best suited to my needs. Are there things I'd have to consider that are no longer supported by the API or so? Can you recommend a better/ up to date tutorial? Thanks a lot.
  9. hmmm understood thanks. So hidemyass doesn't use curl, what does it use then? Also in its case the IP I get when surfing through them is the IP of their server right? So how is it possible to allow users to use my server as a proxy with fully working javascript and stuff? I'd be grateful if you could point me to a tutorial or recommend a script. Thanks again and sorry for the headache!
  10. That's a pretty helpful reply, thanks. I tried Curl (new to it) and was able to access from my PC and bypass protection. HOWEVER: 1. javascript did not seem to work. Can't those javascript issues be fixed on curl? 2. No links would work. (I think because they were relative links because when I clicked login it went to mydomain.com/login not twitter.com/login). Is there a way around that? How does a service like hidemyass.com manage to load sites flawlesly with all the js and everything? Thanks!
  11. Yes you can say that. The government here in Egypt is censoring the web because of the protests. Perhaps you've already heard a bit. So I'm trying to code a simple solution that'll allow users to access twitter and bypass what's happening. They don't want people not talk. So there aren't any bad intentions as you were thinking Hope it's clear now!
  12. Thanks for your response. Nope. I simply want to redirect them to the real site2.com but "anonymized". Just like how the network settings in firefox work as in the example above. Thanks!
  13. Hello there everyone. I'll try to explain as thorough as I can so please bare with me a bit. One you want to surf the web through a proxy in firefox, you go to tools > options > network > settings and enter proxy details which for example are like this. 173.123.123.4 and port 8080. I want to do pretty much the same thing with php for my visitors. I have www.site1.com which will have all my scripts and stuff. I want it to somehow redirect or load to www.site2.com USING A PROXY so that when the visitor reach site2, it's as if they have edited their firefox settings to view site2 using a proxy. That way visitors will always be anonymous on www.site2.com. While searching, I found this: http://stackoverflow.com/questions/3889715/php-requests-through-proxy Which seems simple enough but does not work unfortunately. Not that I'm even sure that it's indeed what I want to do but it seems like it...lol. Thanks a lot for any help provided.
  14. Finally decided to go with your first suggestion. Thanks.
  15. So basically I cannot use the div border for example to make those two lines without using images, right? (i.e: obtain the view you see now at the URL I posted in the first post) Bold part, "including both lines". Got confused at that one. How can I do that with the space between them? Meaning, there are two lines and in between a header image. Are you suggesting that I put them all together, perhaps? Sorry if I'm being stupid, please bare with me. The problem is, I'm very novice at CSS Thanks Hybride, and thanks in advance for anybody that will take the time to throw any input.
  16. So I'm taking my baby steps through this CSS world and the first thing that keeps hitting me and really delaying anything I do, forcing me to start all over is CSS browser compatibility. I tried quite a smile CSS design here: http://isimplifytech.com/css-help/ Feel free to take a look at the source and stylesheet. Uses multiple background images to build the layout which seemed only supported by FireFox, Chrome and Safari. IE and Opera will not show anything at all. Instead a white page. Solution suggested by a friend was to use bordered divs for the orange lines (please use ff, chrome or safari to be able to view the thing) and another one for the header image, refraining from any use of bg images. Construction the divs in the stylesheet went ok but then they won't display on the page. For example, to constrcut the border, Adam, a member here suggested: #oline { border: 1px solid red; border-width: 0 1px; } This wouldn't display the exact orange line you see in the existing layout, just a test. Now to display it, I used: <div id="oline"></div> and tried <div id="oline"><!------></div> But no browser renders it. Well, whatever way this is doable, all I want to do is make the page look like you see it now, but compatible with all browsers and minimal resource usage (not using an image for the orange border and using the suggested bordered-div perhaps) Thanks!
  17. Hey thanks a lot everyone. Just changing the "backwards" statements did the trick. So indeed it was the weekend then, the reason for this lol, I'm embarrassed. Everything else is fine and of course, the script threw no errors at me at all so I just couldn't figure out what was going on. Again, thanks again!
  18. *bump* This was posted in the weekend and probably nobody saw it. Sorry for the bump, was just hoping that someone may be able to help out.
  19. Hi there everyone. Thanks for taking the time to take a look at this. Basically what I'm trying to do is make a simple script that allows users to enter a URL, expiry time and view limit and then get a mydomain.com/links/get.php?id=AUTOLINKID. That loads their specific URL and expires in time. This is my first attempt to use mysql. So in short, it's kinda a very very basic URL expiry service...lol. So here's the PHP page that gives me all the trouble: <?php // Establish database connection mysql_connect("localhost", "db", "pass") or die(mysql_error()); mysql_select_db("akkari_links") or die(mysql_error()); // If there is no link ID, that saved us a lot of effort; Kick'em out! if (!@$_GET['id']) die ('No download ID supplied!'); $dl_id = mysql_real_escape_string($_GET['id']); // Get the database row that corresponds to the link ID. $result = mysql_query("SELECT * FROM expire WHERE id='$dl_id'") or die(mysql_error()); // No comment $array = mysql_fetch_array($result) or die(mysql_error()); // Otherwise, there is an id and FOR NOW, we'll assume it's valid. if ($array['expires'] > time() && $array['viewcount'] < $array['viewcap']){ // Looks a little compicated, but really just fetching the URL using iframes that's all...lol. $array['path'] = $path; echo "<!DOCTYPE html> <html> <head> <meta name=\"robots\" content=\"noindex\"> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> </head> <body> <div id=\"root\"> <iframe src=\"$path\"> Your browser does not support inline frames. </iframe> </div> <style> @charset \"utf-8\"; body { margin: 0px; padding: 0px; } /* iframe's parent node */ div#root { position: fixed; width: 100%; height: 100%; } /* iframe itself */ div#root > iframe { display: block; width: 100%; height: 100%; border: none; } </style> </body> </html>"; // Increase view count by one. $array['viewcount'] = $viewcount; $viewcount++; // Now store new value in database. $array['viewcount'] = $viewcount; mysql_query("UPDATE expire SET viewcount='$viewcount' WHERE id='$dl_id'") or die(mysql_error()); } else{ // Time limit or view cap exceeded, throw 'em out. echo $array['errormessage']; } mysql_close(); ?> Now problems time: 1. When you visit get.php?id=VALIDID, nothing happens. Just a white screen. I wish there was some kind of error 2. the viewcount never gets incremented in the database for some reason. Expected questions: iframe code? Haven't written it myself but worked perfectly well for me in other scripts so I just copied it. Why not use header function? I don't the real URL to stay hidden. Header will just make a redirect. And anyway, I tried replacing iframe code with header() and it still throws a white page at me . If you have another solution to this, please point it out! I thought it may also be helpful to state that the whole code executes successfully. Tried to echo "done!"; at the end of the file and it echoed. Thank you very much for the support!
  20. I can't thank you enough for the two suggestions in bold. I kept tracking down errors from missing bracelets to problems on AlertPay's end. The major problem I was having is that my client couldn't possibly understand that the IPN security code is to be generated ONCE. When I told him generate a new one for me he did, he gave it to me then clicked generate again, he treated it like some kind of coupon code generator. So I was left with a whole bunch of security codes and don't know what is working and what's not. I simply used error_log() in the if() that checked the IPN security code and viola! My email kept receiving "IPN security code mismatch". Anyway, now when the customer successfully checks out, he gets sent an email attachment containing his ebook (php email attachments are another story! lol). Thank you very much for everyone that has contributed to this thread. I just thought of updating it so that whoever was subscribed would be able to see how it went. I think I have kinda a solid understanding of AlerPay's IPN after this experience..lol, if anyone is struggling with it specifically; I can do my best to help. Thanks again everyone!
  21. You bet I did OK, applying your suggestion now, let's see how it goes. If it works, then it's definitely something on their end. I don't know how I didn't think of setting temporary values for them. I'll follow your instructions and report back, thanks a bunch.
  22. Well bascially you might just be giving yourself a huge, unneccassry headache if you don't work with AlertPay. If it wasn't a client request, I wouldn't have come near playing around with their IPN. Working with payment gateway IPN and APIs gives me the creeps anyway...lol. I hope someone could help me. In the meantime, I'm trying to sort things out with an integration specialist on their end, see if it's something on their end.
  23. Yeah, well bascially that's why I was hoping that someone who has dealt with their IPN handler before would know what's going on. Thanks a lot though, dabaR
  24. I could but remember that this is an IPN file. Meaning the file never gets accessed directly and so never outputs anything. The payment processor simply sends POST variables to the file which are then converted into local variables by using $_REQUEST and then compared. However to answer your question, yes, this argument evaluates true.
×
×
  • 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.