Jump to content

sloth456

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

Everything posted by sloth456

  1. If your resellers have their own domains and hosting, perhaps you could write up some code that will allow their websites to connect to your database of products and display it. Kinda like an API? I think the email idea is a good one, not sure why your resellers forwarding would ruin the HTML? Perhaps another solution is to create a form on your site where resellers could enter the emails of their clients and the products they want to sell, then your website sends a HTML email direct to their clients.
  2. Kind of difficult to visualize the output and get an idea of what you're trying to achieve, can you post a URL to the form and rephrase your question.
  3. You haven't enclosed the second foreach statement in curly brackets. It should be: foreach($links as $page) { $phtml = file_get_html($page); // find all td tags with attribite align=center foreach($phtml->find('span[id=name]') as $name){ echo $name->plaintext.'<br><br>'; } }
  4. Ok firstly: Your index.php file does not perform any sql operations, it doesn't do the database stuff so the echo mysql_error(); line won't show you anything. So you may as well delete it or comment it out like this //echo mysql_error(); Next, you need to see whats going wrong with your sql so in admin_save_sm_db.php we need to remove the '@' symbols. The '@' symbols supress errors, by removing them we'll see what's going wrong. So here's an updated version. <?php session_start(); if(!isset($_SESSION["username"])) { header('Location: login.php'); exit; } @require("../sm_admin_db.php"); $authtype = $_POST['authtype']; $identity = $_POST['identity']; $flags = $_POST['flags']; $name = $_POST['name']; $immunity = $_POST['immunity']; $user_email = $_POST['user_email']; $link = mysql_connect(_HOST,_USER,_PASS); mysql_select_db(_DB); $sql = mysql_db_query(_DB,"INSERT INTO "._TBL." (`authtype`, `identity`, `flags`, `name`, `immunity`, `user_email`) VALUES (NULL, '$authtype', '$identity', '$flags', '$name', '$immunity', '$user_email')") OR die(mysql_error()); $okay = mysql_affected_rows(); if($okay > 0) { header( "Location: ../index.php?value=success" ); } else { header( "Location: ../index.php?value=fail" ); } mysql_close($link); ?> you'll have noticed I also added some extra code on your insert query OR die(mysql_error()) Now if for some reason that insert query doesn't work the script will terminate and show you an error from which we can hopefully figure out your problem. Make these changes, run it all and post back what errors come up.
  5. Hi, I have a challenging dilema. A client keeps track of his stock using a microsoft access database in store. His ecommerce website which is hosted elsewhere uses php and mysql. Is it possible to to integrate the 2 so that when someone buys a product from the website, the store MS access database is updated to reflect this and vice versa? If so how would I go about it? Thanks in advance. P.S: I'm extremely tempted to suggest that he should stop using his ms access db and instead reccommend that I set him up a suitable backend on his website for keeping stock control, then he just login to that in the store.
  6. I really appreciate your input, I've seen this page before but I'm finding it really hard to understand. Is there a good tutorial you can point me to? Or even better, a ready made function/class? Sorry to be such a noob, I'm finding this hard!
  7. I have an xml file thats about 20MB, I want to parse it all into an array. SimpleXML seems to have trouble processing it, I just get "Fatal error: Balloc() failed to allocate memory". I've googled this topic and can't seem to find a straight forward solution. There must be someone here who has had to do this before. Is there an easy way to parse this?
  8. Seems the trouble is my xml file is very big. When I use a smaller test xml file it works. So my question is now, how can I parse a large xml file?
  9. When I look in my error log this comes up: [29-Nov-2010 08:18:07] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-zts-20060613/ixed.5.2ts.lin' - /usr/local/lib/php/extensions/no-debug-zts-20060613/ixed.5.2ts.lin: undefined symbol: executor_globals_id in Unknown on line 0
  10. xD Man I know that feeling all too well, glad to have helped. please click the 'topic solved button at the bottom of the page so others can see.
  11. Weird, the only thing that looks odd in your echo statement is your quote marks <?php echo “Welcome to PHP World!”; ?> shouldn't it look like <?php echo "Welcome to PHP World!"; ?> I'm not sure if this will make a difference, good luck.
  12. After much umming and ahing I think I have the solution. Do your select statement after your update statement? Like this if ($_GET['ap']) { $bid = $_GET['ap']; mysql_query("UPDATE ban_rotator SET status = 'Active' WHERE id = '$bid'"); } $bq = mysql_query("SELECT id, usrid, bname, burl, btarget FROM ban_rotator WHERE status = 'Waiting'"); $pb = mysql_num_rows($bq); I think this should work, I haven't thought it all the way through, kind of got a hunch that might be your problem though.
  13. Thanks, but that value was already set to true.
  14. textareaResponse-LW_01.asp sequence=&dsttext=&mode=html&username=&password=&Submit=FREE+Translation&charset=UTF-8&template=textareaResponse-ETS.asp&lwSrc=eng&lwDest=ara&lwPair=59&Project=&transType=LW&language=&targetServer=LW&srctext=bla+bla+bla&srcLang=English&dstLang=%3Aeng%3Aara%3A59%3A%3A%3ALW&submitbut=Translate&respSupplier=FREETRANSLATION&resptext= Thats the post string you need. I got it by using live http headers. What you do is open live http headers and freetranslation.com. Untick capture and also clear everything. Enter some text into the form, then before pressing the translate button, go back to live http headers and tick capture. Then press the translate button and under the 'generators' tab in live http headers you'll see the post data as above. To use it do the following: $fp = fopen("cookie.txt", "w"); fclose($fp); function curl_post($url,$data,$proxy,$proxystatus){ $post = curl_init(); curl_setopt($post, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($post, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($post, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($post, CURLOPT_TIMEOUT, 40); curl_setopt($post, CURLOPT_RETURNTRANSFER, TRUE); if ($proxystatus == 'on') { curl_setopt($post, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($post, CURLOPT_HTTPPROXYTUNNEL, TRUE); curl_setopt($post, CURLOPT_PROXY, $proxy); } curl_setopt($post, CURLOPT_URL, $url); curl_setopt($post, CURLOPT_HEADER, TRUE); curl_setopt($post, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($post, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($post, CURLOPT_POST, TRUE); curl_setopt($post, CURLOPT_POSTFIELDS, $data); ob_start(); // prevent any output return curl_exec ($post); // execute the curl command ob_end_clean(); // stop preventing output } $response=curl_post('http://www.freetranslation.com/textareaResponse-LW_01.asp','textareaResponse-LW_01.asp sequence=&dsttext=&mode=html&username=&password=&Submit=FREE+Translation&charset=UTF-8&template=textareaResponse-ETS.asp&lwSrc=eng&lwDest=ara&lwPair=59&Project=&transType=LW&language=&targetServer=LW&srctext=bla+bla+bla&srcLang=English&dstLang=%3Aeng%3Aara%3A59%3A%3A%3ALW&submitbut=Translate&respSupplier=FREETRANSLATION&resptext= ','','off'); echo $response; In this data string I'm transalting 'bla bla bla' from english to arabic. Hope that helps!
  15. Well your code looks good, but I can't see how to fix this without seeing the rest of your code. Could you maybe attach the files related to the approval process.
  16. Hi guys, This has been bothering me for quite some time. I have a piece of code that works absolutely fine on my local XAMPP setup but causes a 500 internal server error when I run it on my host (hostgator). $source = "marketplace_feed_v1.xml"; $xml = simplexml_load_file($source,'SimpleXMLElement', LIBXML_NOCDATA); SimpleXML is enabled on hostgator marketplace_feed_v1.xml is located in the same directory as this script I don't understand why this won't work Any help at all is much appreciated.
  17. Thanks guys, I suspected it might not be possible to get what I want. I've tried to look in the HTMl to see where the captcha token is generated or if there was a way of requesting one from a file on Adwords, no luck so far but I'll keep trying. As for decoding the captcha image, I'll probably just end up using decaptcha or something. Or retrieve and enter it manually.
  18. Thanks AbraCadaver! That seems to be part of the solution, I get this: GET /o/Targeting/Explorer?__c=1000000000&__u=1000000000&ideaRequestType=KEYWORD_STATS#search.none HTTP/1.1 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1 Host: adwords.google.com Accept: */* Cookie: S=adwords-optimization=-DwrCLnPsqsWKQcAK4nJyw; AdsUserLocale=en_US; PREF=ID=b2a448c2548e92a2:TM=1264175150:LM=1264175150:S=xxonXdFebwKBUsGH How can I get the rest of the data as shown in my first post? I'm particularly interested in obtaining this line GET /o/Targeting/captchaData?token=AJtyWwbzrehZWrT8puwruvcvjxCHnRJWKqWvpWfw54W2AjmF2cAlFpYLcL13KE0hi7retjZclcFHqnd8yMC0vDfP4tRNXISZ1QfbdLBK_WVW1wqlzqrR2ouSBgclxUiU0RiHUXHWy1VrIlo5oq3xNeemD-dZHQr0ed1s6p-dBF9mvyvkct1BifkXPAD___W32qxemYPbi6qvgpec3-rgsesGVUoYPglxzg&type=IMAGE Thanks for all your help so far, really appreciate it.
  19. Hi everyone, thanks for reading. I have live HTTP headers installed on Firefox, hopefully some of you will be familiar with this addon. I would like to make a php script that is able to do what live http headers does, that is, I'd like to be able to give the script a URL and it will return all the headers. I know how to use CURLOPT_HEADER and CURLOPT_RETURNTRANSFER but this doesn't quite do what I'm looking for. For example if I go to : https://adwords.google.com/o/Targeting/Explorer?__c=1000000000&__u=1000000000&ideaRequestType=KEYWORD_STATS#search.none with Live HTTP Headers switched on I get the following data under the 'generators' tab GET /o/Targeting/Explorer?__c=1000000000&__u=1000000000&ideaRequestType=KEYWORD_STATS GET /cues/cues.js GET /ga.js GET /cues/cb?__u=1000000000&__c=1000000000&l=en_US&v=5E5BE5A3D9AD806BA7FF2C9FE2E15DF9&a=1000000000 GET /cues/metrics/?requestType=external&startTime=1287073462287&browserStartTime=1287073471028&browserEndTime=1287073472156 GET /cues/metrics/?requestType=notabs&startTime=1287073462287&browserStartTime=1287073471028&browserEndTime=1287073472162 GET /o/Targeting/clear.cache.gif GET /__utm.gif?utmwv=4.8.6&utmn=606563096&utmhn=adwords.google.com&utmcs=UTF-8&utmsr=1280x1024&utmsc=24-bit&utmul=en-gb&utmje=1&utmfl=10.1%20r85&utmdt=Google%20AdWords%3A%20Traffic%20Estimator&utmhid=1700273830&utmr=-&utmp=%2FAnonymous%2FTargetingExplorer%2FKeywordStats%3Fcontext%3DHistoryChange%26__c%3D1000000000%26__u%3D1000000000%26ideaRequestType%3DKEYWORD_STATS&utmac=UA-3418223-1&utmcc=__utma%3D229779660.119716289.1279381615.1286975241.1287071773.41%3B%2B__utmz%3D229779660.1279381615.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=q GET /o/Targeting/F098CA184E661C697D29595B67C57BAA.cache.png GET /favicon.ico POST /o/Targeting/captcha?__u=1000000000&__c=1000000000&challengedService=/o/Targeting/g 6|1|4|https://adwords.google.com/o/Targeting/|02990CDDCF521142AE1B373ED2008D94|_|getToken|1|2|3|4|0| GET /o/Targeting/captchaData?token=AJtyWwbzrehZWrT8puwruvcvjxCHnRJWKqWvpWfw54W2AjmF2cAlFpYLcL13KE0hi7retjZclcFHqnd8yMC0vDfP4tRNXISZ1QfbdLBK_WVW1wqlzqrR2ouSBgclxUiU0RiHUXHWy1VrIlo5oq3xNeemD-dZHQr0ed1s6p-dBF9mvyvkct1BifkXPAD___W32qxemYPbi6qvgpec3-rgsesGVUoYPglxzg&type=IMAGE GET /favicon.ico However my current CURL script only returns the following HTTP/1.1 200 OK Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: Fri, 01 Jan 1990 00:00:00 GMT Date: Thu, 14 Oct 2010 17:05:12 GMT Content-Type: text/html; charset=UTF-8 X-Invoke-Duration: 8 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE Transfer-Encoding: chunked This is my script so far <?php $url="https://adwords.google.com/o/Targeting/Explorer?__c=1000000000&__u=1000000000&ideaRequestType=KEYWORD_STATS#search.none"; $useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"; //next open a new CURL session $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERAGENT, $useragent); curl_setopt ($ch, CURLOPT_HEADER, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_FRESH_CONNECT, 0); curl_setopt ($ch, CURLOPT_CAINFO, dirname(__FILE__)."/cacert.pem"); $source=curl_exec($ch); //the source code is now stored in $source, lets close the curl session curl_close($ch); echo $source; ?>
  20. Decided to give up and scrape another site with essentially the same information.
  21. Aha! thank you for all your help guys. GingerRobot, yep it was a cookie thing, I just turned off cookies in my browser to test and got the same result as curl. How do I get cURL to use cookies?
  22. This has been really frustrating me for about 2 days now. $url="http://www.goldpoll.com"; $agent="Firefox/3.5.7"; $referer=""; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_REFERER, $referer); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_close($ch); $source=curl_exec($ch); echo $source; As you can see, all it does is scrape http://www.goldpoll.com. I'm running the scraper locally, everytime I run it my browser redirects to localhost/public/j?kdwN+HG+V30X1eO0TNripy8= The characters at the end are random everytime. I thought my when I'm echo'ing the code I'm also echo'ing out some redirection code, so I commented it out, I still get exactly the same thing hapening. I thought, maybe there is some kind of setting not right in my server. So I changed the url to google.com. It seems to work fine for google. I thought, maybe goldpoll is blocking my I.P, but if I navigate there through my browser it works fine. So I just don't get it, its really confusing me. Does Goldpoll.com have some kind of advanced protection against scrapers? Any help would be massively appreciated!
  23. I looked at that myself before posting here. I tried to figure out how the code in the plugin worked. It seems an awful lot of code for what I want to do, surely there must be a simpler way?
×
×
  • 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.