Jump to content

papaface

Members
  • Posts

    1,437
  • Joined

  • Last visited

    Never

Contact Methods

  • MSN
    papa_face@hotmail.com
  • Website URL
    http://www.5ite.com

Profile Information

  • Gender
    Not Telling

papaface's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Found the issue and for some reason it is IE. I tried it in firefox and it worked without an issue. How strange...
  2. Hey I wonder if someone can help be debug a script that is giving me a right headache. The script receives data from an API. I have this code: $message="<html><head><style> body,td { font-family: verdana; font-size: 11px; font-weight: normal; } a { color: #0000ff; } </style></head><body>".$message."</body></html>"; echo "hello"; $Users=getClients(); getClients() function: function getClients(){ global $count,$INCREMENT; $url = "http://URLapi.php"; $username = "dev"; $password = "password"; $postfields["limitstart"] = $count; $postfields["limitnum"] = $INCREMENT; $postfields["action"] = "getclients"; $postfields["username"] = $username; $postfields["password"] = md5($password); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); $data = curl_exec($ch); curl_close($ch); echo $data; $xml = simplexml_load_string($data); $Xml = simpleXMLToArray($xml,true,true,true); return $Xml; } If you look in the first bit of code you'll see echo "hello"; If I remove this the data from the cURL request outputs to the screen via my echo $data; code. If I keep echo "hello"; it stops processing and nothing is displayed. What could be causing this?
  3. Yeah, I think the initial checking should be done via regex, but there would need to be a way of cross referencing the records so that it can spot a duplicate. The database has around 127,000 links.
  4. Hi there I'm trying to work out how I'd go about searching my database for URLs that have been submitted by users that are duplicates. Now this isn't as simple as http://www.example.com/something.php and http://www.example.com/something.php oh no! People have entered links such as http://www.example.com//something.php or http://www.example.com///something.php The script (I didn't write it) currently see's these links as unique, but they're not. They function exactly the same way. Anyone have any advice on how to weed these out? I was thinking maybe a straight forward LIKE '%//%' in the mySQL syntax, but this will bring all URLs up due to the http:// aspect of the link Any feedback would be appreciated!
  5. Thanks. I realised it was outputting, but I just couldnt see it. Thanks!
  6. Hi I have the following HTML: <div class="categories"> <a href="http://www.domain.com/asp-tutorials" class="catTitle"> <img src="http://www.domain.com/img/29.jpg" alt="ASP Tutorials"></a> <a href="http://www.domain.com/asp-tutorials" class="floatLeft catTitle">ASP Tutorials</a><a href="http://www.domain.com/asp-tutorials/rss/categories.php?chid=29" title="RSS Feed for all ASP Tutorials!" class="rss"><img src="http://www.domain.com/images/rss_icon.gif" width="28" height="12" alt=""/></a> </div> I am trying to retrieve the href in this line using regex: <a href="http://www.domain.com/asp-tutorials" class="catTitle"> I have this: $expr = '/<div class="categories">.*?<a href="(.*?)" class="catTitle">.*?<img src=".*?" alt=".*?"><\/a>.*?<\/div>/s'; preg_match_all($expr,$file,$info,PREG_SET_ORDER); print_r($info); But it is returning no results. There are a few categories on the page which I'm trying to retrieve the links for. Anyone have any idea why?
  7. Thanks for that Ken! Works perfectly. I really need to learn me some regex!
  8. Hey I have a string that looks like the following: I have a script that cycles through each page. The 2 in the quote above is the page number. How can I extract the number between the - and the .html and replace it with another number? I've tried substr($engine->selectedcaturl, 0,-6).$v.".html" But then I realised this only works for numbers that are 1 digit long Any input would be appreciated
  9. Alright, I think I've resolved it with using screen in ssh. It appears the SSH session may have been timing out...Looking into it a bit further though.
  10. I have a script that runs for quite a while (about 700 second per video). When it is run, it outputs some information for a cURL session. Once the cURL process is initiated php starts downloading a large file to a directory. The file is around 65mb. When the file is finished downloading through curl I have the following code: echo "Downloaded <br />"; $sw->runDBQuery("UPDATE `videoinfo` SET `videoDownloaded` = '1' WHERE `videoStorageKey`= '".$videostoragekey."' "); The problem I am having is that the script is NOT outputting "Downloaded" in SSH or in the browser BUT the SQL query is being run correctly, and in the background the script moves onto the next file to download (i can see this by monitoring the download directory) but I see no output at all! This leads me to come to two conclusions. Apache is not timing out the request as in SSH, apache is not involved. The browser is not at fault, as I am using Putty. So what could be causing this issue? I am TOTALLY stuck. I cannot work out what the issue could be, it is driving me insance. Any help would be appreciated.
  11. Always remember, sessions are stored on the server, NOT the computer of the person viewing the page. For that, you need cookies.
  12. Hi I'm currently writing a script that basically downloads videos from a specific page. I am downloading with cURL however with some files, they're so large cURL is timing out. This is causing either a) PHP to timeout b) PHP memory to run out c) cURL to stop once defined timeout limit is reached This means that some files are only partitially downloaded as some files are over 100mb and some are only 20mb I have set_time_limit(0); and ini_set("memory_limit","500M"); set but is there a way to make it so PHP will not timeout and the cURL session will not timeout until the file is downloaded?
  13. <?php session_start(); if ($_SESSION['basic_is_logged_in'] == true) { echo "you are logged in"; } else { if(isset($_POST['btnLogin']) || isset($_POST['addpost'])){ $txtUserId = $_REQUEST['txtUserId']; $txtPassword = $_REQUEST['txtPassword']; if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) { if ($_POST['txtUserId'] === 'admin' && $_POST['txtPassword'] === 'abc123') { $_SESSION['basic_is_logged_in'] = true; echo "you are logged in"; } elseif (empty($txtUserId) || empty($txtPassword)) { echo "fill in username and password"; } elseif ($_POST['txtUserId'] != 'admin'){ echo "wrong username"; } elseif ($_POST['txtPassword'] != 'abc123'){ echo "wrong password"; } } } ?> <?php //if (!isset($_SESSION['basic_is_logged_in']) // || $_SESSION['basic_is_logged_in'] !== true) ?> <html> <head> <title>Main User Page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form method="post" name="frmLogin" id="frmLogin" action="main.php"> <table width="400" border="1" align="center" cellpadding="2" cellspacing="2"> <tr> <td width="150">User Id</td> <td><input name="txtUserId" type="text" id="txtUserId"></td> </tr> <tr> <td width="150">Password</td> <td><input name="txtPassword" type="password" id="txtPassword"></td> </tr> <tr> <td><input type="submit" name="btnLogin" value="Login"></td> </tr> <tr> <td><input type="submit" name="addpost" value="add post" /></td> </tr> <tr> <td><input type="submit" name="showstat" value="Show visitors log" /></td> </tr> <tr> <td><input type="submit" name="blogg" value="To blog (logout)" /></td> </tr> </table> </form> </body> </html> <?php } ?>
  14. When I say >PHP</a> I mean I want the word PHP
  15. Hey I am wondering if someone could please give me the regex to retrieve the <div class="category-thumb"> <a href="/categories/php" onClick="pageTracker._trackEvent('Coding Tutorials','Click Here');"><img src="http://www.domain.com/img/phpcode.jpg" alt="PHP" /></a> <h6><a href="/categories/php" onClick="pageTracker._trackEvent('Coding Tutorials','Click Here');">PHP</a></h6><span>5 tutorials</span></div> I am trying to obtain this part of the block: There are mutliple blocks like this on the page so I am building up an array with preg_match_all($expr,$this->html,$info,PREG_SET_ORDER); Any help would be appreciated!
×
×
  • 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.