need help, pyhon, url, var, post, error, socket

This is the place for queries that don't fit in any of the other categories.

need help, pyhon, url, var, post, error, socket

Postby Mr. Scanner » Sun Apr 07, 2013 11:59 am

import urllib
import urllib2
import os
import time

my_server = '#mywebsitehere'

def postSmallData(data):
postthis = "/uURLvar.php?upload="+urllib.quote(str(data))
conn = httplib.HTTPConnection(my_server)
conn.request("POST", postthis)

def ss2(string,BlockLength):
start = 0
end = BlockLength
loop = True
p = 0
while loop:
start += BlockLength
end += BlockLength
#a delayer , thought may get the job done :(
p += 1
if p == 160:#for server to wait
p = 0
if start > len(string): loop = False

a = open('largefile.7z','rb').read().encode('hex')
ss2(a, 4000)#this post data to php 4000 byte one post

#it works only for small bytes ~12kb max i think

#when i post something larger ex: 600kb, get an socket error, WHAT TO DO?
#i want to use URL var post as an file uploader with php.
#any recomandation?
Mr. Scanner
Posts: 1
Joined: Sun Apr 07, 2013 11:48 am

Re: need help, pyhon, url, var, post, error, socket

Postby Yoriz » Sun Apr 07, 2013 2:27 pm


Please could you edit your code to include code tags so the indention is correct.
Please read the following link on how to ask questions/post your code.
Due to the reasons discussed here we will be moving to on October 1 2016
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 1672
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 4 guests