Jump to content

btray77

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

btray77's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks, I completely forgot about that function.. and didn't see it when I was looking on php.net in the date/time functions information. -Brad
  2. how to convert 2009-10-29T06:54:56.000Z to unix time stamp.. thanks
  3. Thanks, what about keeping it as a stdObj? -Brad
  4. I have a datafeed I'm getting data from, and I need to be able to loop though the datafeed and store information in a stdClass object or Array. I've tried: $x = json_decode( $x ); foreach ( $x as $item ) { $info[] = $item; //ERROR } How do I do this? Thanks
  5. found the problem: http://www.website.com/request/findItems= should be http://www.website.com/request?findItems= Thanks if you were working on helping me on this. -Brad
  6. Ruby Code: { "itemFilter" => { "keywords" => "milk" }} my_input = { "itemFilter" => { "keywords" => "milk" }}.to_json # Turn hash input into JSON, store it in variable called "my_input" @http = Net::HTTP.new("website.com") # Open connection to website.com response_code, data = @http.post("/requests", "findItems=#{my_input}") # Post the request to our API, with the "findItems" name and our JSON from above as the value response_code, data = @http.post("/requests", "findItems=#{input}", {'X-CUSTOM-HEADER' => 'MYCUSTOMCODE'}) my_hash = Crack::JSON.parse(data) my_milk = my_hash["findItems"]["item"].first Here's what I have so far, which might be totally wrong.. Any help would be appreciated. <?PHP $requestBody =json_encode(array("itemFilter" => array( "keywords" => "milk" ))); $headers = array ( //set the keys 'X-CUSTOM-HEADER: ' .'MYCUSTOMCODE', ); //initialise a CURL session $connection = curl_init(); //set the server we are using (could be Sandbox or Production server) curl_setopt($connection, CURLOPT_URL, 'http://www.website.com/request/findItems='); //stop CURL from verifying the peer's certificate curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0); //set the headers using the array of headers curl_setopt($connection, CURLOPT_HTTPHEADER, $headers); //set method as POST curl_setopt($connection, CURLOPT_POST, 1); //set the XML body of the request curl_setopt($connection, CURLOPT_POSTFIELDS, $requestBody); //set it to return the transfer as a string from curl_exec curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1); //Send the Request $response = curl_exec($connection); //close the connection curl_close($connection); print_r($response); Thanks -Brad
  7. No as I had said, It times out... I'm guessing I need something that uses Ajax to re-request the script do something... -Brad
  8. I need to do something other than use set_time_limit(); I still get timeouts on huge database imports. (Command line is not available, and the data feed is not a standard format, so there is no real way of doing mysql's CSV or XML import command) I am importing about 100,000 products, and images from a datafeed. I have NO problems if I don't have to download the images, but the time that it takes to download the images causes the system to timeout. (and it's not from a browser timeout issue, I've got it sending data to the screen each time it does an action) I was thinking about possibly using ajax to call the script to run 1 query at a time, but I'm not sure how to do this. 1. Anyone know of a tutorial on something like this? (I have jquery loaded) 2. If this is not a "good" way, can you give me an idea of how you would do this? Thank you -Brad
  9. I need some help on how to make a class that will parse out FTP MLSD command data (Look at $dirlist for what this data looks like). Below is an example of what I've got so far. I need to be able to easily page though the list and tell if it's a cdir, pdir, size, modified date, and file name. If someone could help me on this I would be grateful. The bad code I have so far: <?php $dirlist = array(); $dirlist[]='size=0;type=cdir;create=20070706174144;modify=20090928144627; .'; $dirlist[]='size=0;type=pdir;create=20070705203844;modify=20091008050005; ..'; $dirlist[]='size=252;type=file;create=20070706174144;modify=20090928144627; 10059-janitorial.zip'; $dirlist[]='size=1946215;type=file;create=20070706174152;modify=20090928144627; 10059-office.zip'; $dirlist[]='size=59658117;type=file;create=20070706174252;modify=20090928144622; 10059.txt'; $dirlist[]='size=6285651;type=file;create=20070706175413;modify=20090928144622; 10059.txt.gz'; $dirlist[]='size=6285853;type=file;create=20070706175529;modify=20090928144624; 10059.zip'; //print_r($dirlist); for($i = 0; $i < sizeof($dirlist); ++$i) { $temp = array(); $temp = explode(';',$dirlist[$i]); for($x = 0; $x < sizeof($temp); ++$x) { $td[$i][$x]=explode('=',$temp[$x]); } //$dirarray[$i] } echo "<PRE>"; //print_r($dirarray); print_r($td); echo "</PRE>"; ?> Thanks
  10. @ ingace Thanks for the information. To do the insert i'm using what I learned from this tutorial.. http://www.softwareprojects.com/resources/programming/t-how-to-use-mysql-fast-load-data-for-updates-1753.html Data insertion is very fast, with this. I just need a way to get the file "fast" programicaly in php or possibly perl VS having to wait a predetermined amount of time with a cron. The updates are not always at the same time. Thanks -Brad
  11. Hi, what would you suggest for downloading a HUGE file from another server? I need to download a large CSV file, about 1.6 GB and insert it into the database. right now I'm FTPing the file over, and using MySQL's LOAD DATA INFILE but I need to automate the downloading of the file. Thanks -Brad
  12. @Zyx That sounds like a great idea except I'm not so good with classes, i'm trying to get away from procedural programming and do the oop but I've yet to figure out everything I need to do. Do you think you could spare the time to put something together on this? I'd appreciate it. -Thanks Brad
  13. @shamuraq I need to be able to populate a database (which I can do) but I need to be able to find out the parent categories from the text file that I'm given. So like before: Cars Cars::4 Door Cars::4 Door::economy Trucks Trucks::4x4 Trucks::4x4::Leather so I need to be able to parse out Cars as a parent, then 4 Door as a child of Cars, and Economy as a child of 4 Door. so the database table would look something like this: catid:int autoinc parent:int default null Name:varchar(100) catid, parent, name 1, null, Cars 2, 1, 4 Door 3, 2, economy 4, null, Truck 5, 4, 4x4 6, 5, Leather I'm having a problem with the logic of exploding the categories out into there parent categories. I think once I sleep on it I will figure it out, but I need to get it done asap. I know it's relatively easy. -Brad
  14. I'm guessing the ads are there because it's the "trial" version. You should purchase it if you do not want the ads. Reverse engineering the code you gave is technically illegal to do in most parts of the world. -Brad
×
×
  • 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.