Jump to content

jjk2

Members
  • Posts

    115
  • Joined

  • Last visited

    Never

Everything posted by jjk2

  1. i have a problem similar to this guy http://forums.devnetwork.net/viewtopic.php?f=1&t=89757&p=492636 using verbose output, i see that LINUX webserver is making GET where as in windows localhost (Wampserver), it used POST. i also test it out on a windows server, and the script works fine.... of course, the script running on linux executes fine, but because its using GET, it fails. the windows one succeeds because it uses POST method, as it should. it uses LIB_http.php, a library from a php book. i heard that setting CURLOPT_POST after CURLOPT_POSTFIELDS, causes problems....i discovered that post was after curlop_postfields as below....maybe this was causing problems in linux webserver? <?php define("WEBBOT_NAME", "Googlebot/2.1 (http://www.googlebot.com/bot.html)"); define("CURL_TIMEOUT", 200); define("COOKIE_FILE", "C:/wamp/www/tor/cookie.txt"); define("HEAD", "HEAD"); define("GET", "GET"); define("POST", "POST"); define("EXCL_HEAD", FALSE); define("INCL_HEAD", TRUE); function http_get($target, $ref) { return http($target, $ref, $method="GET", $data_array="", EXCL_HEAD); } function http_get_withheader($target, $ref) { return http($target, $ref, $method="GET", $data_array="", INCL_HEAD); } function http_get_form($target, $ref, $data_array) { return http($target, $ref, $method="GET", $data_array, EXCL_HEAD); } function http_get_form_withheader($target, $ref, $data_array) { return http($target, $ref, $method="GET", $data_array, INCL_HEAD); } function http_post_form($target, $ref, $data_array) { return http($target, $ref, $method="POST", $data_array, EXCL_HEAD); } function http_post_withheader($target, $ref, $data_array) { return http($target, $ref, $method="POST", $data_array, INCL_HEAD); } function http_header($target, $ref) { return http($target, $ref, $method="HEAD", $data_array="", INCL_HEAD); } function http($target, $ref, $method, $data_array, $incl_head) { # Initialize PHP/CURL handle $ch = curl_init(); # Prcess data, if presented if(is_array($data_array)) { # Convert data array into a query string (ie animal=dog&sport=baseball) foreach ($data_array as $key => $value) { if(strlen(trim($value))>0) $temp_string[] = $key . "=" . urlencode($value); else $temp_string[] = $key; } $query_string = join('&', $temp_string); } # HEAD method configuration if($method == HEAD) { curl_setopt($ch, CURLOPT_HEADER, TRUE); // No http head curl_setopt($ch, CURLOPT_NOBODY, TRUE); // Return body } else { # GET method configuration if($method == GET) { if(isset($query_string)) $target = $target . "?" . $query_string; curl_setopt ($ch, CURLOPT_HTTPGET, TRUE); curl_setopt ($ch, CURLOPT_POST, FALSE); } # POST method configuration if($method == POST) { if(isset($query_string)) curl_setopt ($ch, CURLOPT_POSTFIELDS, $query_string); curl_setopt ($ch, CURLOPT_POST, TRUE); curl_setopt ($ch, CURLOPT_HTTPGET, FALSE); } curl_setopt($ch, CURLOPT_HEADER, $incl_head); // Include head as needed curl_setopt($ch, CURLOPT_NOBODY, FALSE); // Return body } curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE); // Cookie management. curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE); //curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:8118"); // ENABLE TOR curl_setopt($ch, CURLOPT_TIMEOUT, CURL_TIMEOUT); // Timeout curl_setopt($ch, CURLOPT_USERAGENT, WEBBOT_NAME); // Webbot name curl_setopt($ch, CURLOPT_URL, $target); // Target site curl_setopt($ch, CURLOPT_REFERER, $ref); // Referer value curl_setopt($ch, CURLOPT_VERBOSE, FALSE); // Minimize logs curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // No certificate curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); // Follow redirects curl_setopt($ch, CURLOPT_MAXREDIRS, 4); // Limit redirections to four curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // Return in string # Create return array $return_array['FILE'] = curl_exec($ch); $return_array['STATUS'] = curl_getinfo($ch); $return_array['ERROR'] = curl_error($ch); # Close PHP/CURL handle curl_close($ch); # Return results return $return_array; } ?>
  2. hi this is the problem....exact same thing http://forums.devnetwork.net/viewtopic.php?f=1&t=89757&p=492636
  3. i have a simple curl script thats proven to work. it basically logs in to ebay.com it runs fine on commandline through WAMPserver running on my windows, and my other windows servers, but it will not work on any linux server. the script executes, but the result is that i am not logged on to ebay when i run the script on linux server.
  4. i have a simple curl script that grabs today's silver prices. i want to use Tor to hide the servers ip.....and display new ip each day....so it wont look like the server is grabbing the silver prices..... client stressed this, even though i suggested he is paranoid.
  5. lets say i have a link. i want it to display 2 URLS. if i click it once, it will display google.com if i click it the second time, it will display yahoo.com how can i do this using cookie sessions ?
  6. i am using mysql 5 $db -> db_query("SELECT * FROM " . DB_PREFIX . "blocks WHERE type='plain' ORDER BY position ASC");
  7. i want to delay this from sending to quick. #!/usr/bin/php <?php $sql_server = 'localhost'; $sql_user = ''; $sql_pass = ''; $database = ''; $before_id = ''; //This is what you want to go b $after_id = ''; //This is what you want to go afte //$after _id = ''; This is what you want to go after $domain = 'yahoo.com'; //This is what you want after the @. //Just to show where things go for the addresses. <before_id><id><after_id>@<domain> $subject = 'Hi'; //Subject Line. $message = ' message goes here '; $db = mysql_connect($sql_server,$sql_user,$sql_pass); mysql_select_db($database); if ($argc < 2 || in_array($argv[1], array('--help', '-help', '-h', '-?', '--list'))) { if ($argv[1] == '--list') { $list = file_get_contents('searchlist.txt'); $list = explode(';',$list); foreach ($list as $ident) { print $ident.' '; } } else { print 'Usage: '.$argv[0].' <identifier> OR '.$argv[0].' --add <new-identifier> <newsearch> OR '.$argv[0].' --list <identifier> is a preset search you defined. <newsearch> is the search link you wish to add to the list. Example: '.$argv[0].' id1 OR '.$argv[0].' --add test http://chicago.craigslist.org/search/stp?query=m4m&minAsk=min&maxAsk=max If you want to list all current searches, use '.$argv[0].' --list ';} } else { $file = file_get_contents('searchlist.txt'); $identifer_temp = explode(';',$file); foreach ($identifer_temp as $identifer_temp2) { if (!empty($identifer_temp2)) { $temp = explode(' ',trim($identifer_temp2)); $identifer[trim($temp[0])] = trim($temp[1]); } } //print_r($identifer); if (in_array($argv[1],array('--add'))) { if ($argc < 3 ) { print 'You must specify an identifer and a search text. '; } else { if (empty($argv[3])) {print 'You must specify a search string.';} else { $write = fopen('searchlist.txt', 'w'); if (fwrite($write,$file.$argv[2].' '.$argv[3].';')) {print 'New search string added.';} else {print 'There was a problem adding the new search.';} fclose($write); } } } else { //Running the search. if ($identifer[$argv[1]]) { dl("php_curl.dll"); $base = 0; $connect = curl_init(); curl_setopt($connect, CURLOPT_URL,$identifer[$argv[1]]); curl_setopt($connect, CURLOPT_RETURNTRANSFER, 1); curl_setopt($connect, CURLOPT_FOLLOWLOCATION, 1); $result = curl_exec ($connect); while (preg_match_all("/\b[0-9]+.html/", $result ,$matches)) { foreach($matches[0] as $id) { $id = str_replace('.html','',trim($id)); $sql = "INSERT INTO craigslist_mail (id) VALUES ('".$id."')"; if (mysql_query($sql)) { $headers = 'From: '.$id.'@'.$domain."\r\n" . 'Reply-To: '.$id.'@'.$domain. "\r\n" . 'X-Mailer: PHP/' . phpversion(); $mailto = 'pers-'.$id.'@craigslist.org'; mail($mailto, $subject, $message, $headers, '-f'.$id.'@'.$domain.''); print $id.' - Message Sent ';} else {print $id.' - Already in the Database. ';} } $base += 100; $connect = curl_init(); if (explode('?',$identifer[$argv[1]])) { if ($arg = explode('&s=',$identifer[$argv[1]])) { print ' '; curl_setopt($connect, CURLOPT_URL,$arg[0].'&s='.$base); } else { curl_setopt($connect, CURLOPT_URL,$identifer[$argv[1]].'&s='.$base); } } else { curl_setopt($connect, CURLOPT_URL,$identifer[$argv[1]].'index'.$base.'.html'); } curl_setopt($connect, CURLOPT_RETURNTRANSFER, 1); curl_setopt($connect, CURLOPT_FOLLOWLOCATION, 1); $result = curl_exec ($connect); } //$result = explode('<table width="95%" summary="">',$result); //$result = explode('<div',$result[1]); //print $result[1]; } else {print 'Identify does not exist. Please try again.';} } } ?>
  8. http://pastie.org/268643 please help. i log in once. and i log out. i click on login again, i am logged in without it asking me for id or password!!
  9. jjk2

    joint tables ?

    when you have members that has different memberships.... members table: members_id | name | email membership table: members_id | membership_id | membership title is that how you do it ? so members table do not require membership_id.... also what is the fastest way to call something like member.membership thanks!
  10. well i have a dynamic php site. but i like to incorporate php into the flash template. so i the flash template will be populated by the php variables from mysql and so on...
  11. hi i have a flash template that i purchased on template monster. how do i incorporate my existing PHP script to this flash ? can someone direct me ? thank you!
  12. where did you get this design? its very clean and nice.
  13. in 9aca1b0bed3396d01e082c113f65971__e67056a3a1549aa5211b3ad7e212039f__004d.flv.flv.flv how can i select for only whatever is between" __ "and ".flv" so i would end up with 004d ? the above filename is experiment gone horribly wrong....i was attempting to add random letters to protect my videos from ripped in sequence.
  14. mysql_fetch_array(): supplied argument is not a valid MySQL result
  15. Invalid query: Unknown table '912764293f0a8f3643c056c4df5951bd__100.wmv' in field list
  16. im trying to replace video_name with a new name that has random characters added on to it. <?php $conn = mysql_connect('localhost', 'user', 'password') or die ("failed to connect"); $db = mysql_select_db("somedatabase", $conn) or die ("failed to find db"); $result = mysql_query("SELECT * FROM videos WHERE ID > 1186") or die("failed query"); while ($row = mysql_fetch_array($result,MYSQL_ASSOC)){ $tmp_sid = md5(uniqid(mt_rand(), true)); $newname = $tmp_sid . '__' . $row['ID'] . '.wmv; $sql = "UPDATE videos SET original_video = $newname WHERE VIDEOID = $row['VIDEOID']"; $query = mysql_query($sql) or die("epic fail"); mysql_query($query) or die("cannot send query"); } mysql_close($conn); ?>
  17. no.... what i meant was how do i make curl click on links, and get those page contents. i can do the regex stuff.....i am interested in how i can make curl navigate into links, output that page content , and supply cookies if necessary to get into the links.
  18. how can i specify curl to follow each link on a page, and grab a specific results? such as match for all <img> tags ? the first part is only important here. thanks!
  19. i know taht a determined individual can rip contents. if majority of people do not know how rip , then its a success for me. i mean not many people know about cache and stuff. i think theres no way easy way to do it.
  20. i am wondering how i can defend myself against leechers downloading entire video content. they will do http://www.asdf.com/video/0001.flv to 1232.flv effectively downloading all 1232 video files. how can i stop this? such as passing a special key generated by session? http://www.asdf.com/video/0001.flv?key=3w4au7yo80324 or rename all files to e4rot2w3890qp3uywrow.flv ? i would prefer not renaming all files.....because i dont know how to do it in unix env. thank you.
  21. doing the following will repeat folders for each files. <?php set_time_limit(0); $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('C:\wamp\www\test'), RecursiveIteratorIterator::CHILD_FIRST); foreach($files as $file) { if ($file->isDir()){ echo $file . "<br>"; } ?> i would like for it to return only unique folders. i dont want it to output the same folders. for example if one of the subfolders have 3 files. it will spit out C:\wamp\www\test\sub\ for each 3 files. i want this script to fetch me recursively unique folder names.
  22. no i am not interested in echoing the results.... the script works fine. it logs me in alright. but i would like to be redirected to the site where i am logged in....not echoing it back on my localhost because that consumes memory and a lot of bandwith. my question is, how can i directly send a POST with the http header containing username and password to the desired website. so i shouldn't need to echo or print any results, because after the POST, i will be logged in and already at the desired website. function hitForm($loginURL, $loginFields, $referer="") { $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($ch, CURLOPT_URL, $loginURL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_REFERER, $referer); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $loginFields); $ret = curl_exec($ch); curl_close($ch); return $ret; } i would like a function to directly redirect me to the desired site and log me in.
  23. i am able to login successfully using curl to my favorite site forums.asdf.com however, i can only see the site by using printing the results in my localhost. is it possible to send the login, password to the actual forums.asdf.com so that i can directly begin browsing forums.asdf.com instead of using file_get_contents() each time ? this is highly inefficient.
  24. also why was i told this is impossible ? http://www.phpfreaks.com/forums/index.php/topic,199190.0.html what is the difference of that thread and what clipperz accomplishes? thank you for your patience, im very much curious about the powers of cURL lately. its fun :
×
×
  • 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.