DrDoug

craigslist renewing posts -- triggering HTML forms

6 posts in this topic

#1 ·  Posted (edited)

searching for

craigslist

on the

general help and support

forum and looking at some of the existing posts, I can figure out how to get to the HTML on my CL account page. Once I find a listing that has an option to

renew

it, how is that renew action triggered programmaticallly?

here's the item that needs to be renwed, with the values obfuscated.

<td><form action="[url="https://post.craigslist.org/manage/nnn"]https://post.craigslist.org/manage/nnn"[/url] method="POST"><input type="hidden" name="U2FsdGVkX18yODc5O:TI4Nw.oKrVIl0UARegrhuSj8zLZUCoKaeo3nnn" value="renew"><input type="hidden" name="U2Fs.dGVkX18yODc5OTI4N0BY:4eHT9YG4DOZqERyFo7RVws8QosOnnn" value="U2FsdGVkX18yODc5OTI4N0fP6qcCPRX5I8nR1wAXxFjvd2EI24bnnn"><input type="submit" name="go" value="renew" class="managebtn"></form></td>

there's got to be a simple way for a function call to trigger a form action just like a mouse click on the page, but I can't wrap my head around where to go or what to look for in the language guide. I can't tell if I'm doing this the simple way or the hard way, and I don't know how close I am to the finish line. I just don't know. :mellow:

so, any help? I don't need hand holding, but pointers to other code or clues on what calls to look as I investigate would be great.

i've always made the most progress looking at others' existing code.

thanks

Edited by DrDoug

Share this post


Link to post
Share on other sites



Bump. 57 views, but no replies. Am I stumping everybody, or am I being ignored because I'm being too much of a n00bie? ;-)

Doug

Share this post


Link to post
Share on other sites

DrDoug,

Welcome to the AutoIt forum. :)

No-one is ignoring you, but you need to remember that this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hello DrDoug,

I've written a few script for craigslist, so I would like to help you out!

However, I have to be very honest with you, I don't understand the question.

What I like to do is use "inetread" to get the source of the HTML page, then I use StringRegExp to take out what I want from the "ad".

$url = "whatever"
$binhtml = InetRead($url)
$html = BinaryToString($binhtml)

; $html now contains the source code of the page

; now I format the post into a one-line string, with | as a separator of the values that I want.


$title_regex = '(?i:postingTitle.=.")(.*?)"'
$title = StringRegExp($html, $title_regex, 1)
if $logging = 1 and @error then _FileWriteLog($logfile, "Could not get title for post @ " & $url)

$email_regex = '(?i:displayEmail.=.")(.*?)"'
$email_address = StringRegExp($html, $email_regex, 1)
if $logging = 1 and @error then _FileWriteLog($logfile, "Could not get email address for post @ " & $url)

$body_regex = '(?s)<section id="userbody">(.*?)<script type="text/javascript">'
$body = StringRegExp($html, $body_regex, 1)
if $logging = 1 and @error then _FileWriteLog($logfile, "Could not get body for post @ " & $url)

$pics_regex = '<(?i:a href=")(.*?)" title=".">'
$pics = StringRegExp($html, $pics_regex, 3)
$pics_url = _ArrayToString($pics, ',')
if $logging = 1 and @error then _FileWriteLog($logfile, "Could not get pics url for post @ " & $url)

$final = $title[0] & "|" & $email_address[0] & "|" & $body[0] & "|" & $pics_url
$final = StringReplace($final, Chr(10), Chr(13))
$final = StringStripCR($final)
$Formatted_Ad = StringStripWS($final, 7)

If you have more clear info on what you're trying to find, I can help you out somewhere.

Maybe you can take a screenshot of the page?

Edited by PowerCat

Share this post


Link to post
Share on other sites

Necroing:

I have this same issue. I'll try to explain it a different way. In the Craigslist account page, you can choose to 'renew' your posts every three days and then they'll get a fresh look from people. What we're trying to figure out is how to manage the POST command correctly. Here is the "inspect element" in Chrome for the "renew" hyperlink in the account page (I blanked out my account number with ##):

<form action="https://post.craigslist.org/manage/##########" method="POST"><input type="hidden" name="action" value="renew"><input type="hidden" name="crypt" value="U2FsdGVkX182NDQ0NjQ0NNYTGOKaJXDu34zUjkZCkVXDzwxZxSW1KA"><input type="submit" name="go" value="renew" class="managebtn"></form>

I know how to use string-in-string etc. to parse out the URL, actions, values, etc but what I can't get correct is the formatting for the POST command itself. I've tried including and exlcuding different parts (action, value, crypt, etc.). I get a 200 returned using the code below but it doesn't actually renew the post. I know the crypt values are different, they change regularly. 

; The data to be sent
$sPD = 'action=/manage/##########&name=action&value=renew&name=crypt&value=U2FsdGVkX182MzM0NjMzNOpDZW1SVeBDug_VuldCvGPgwoMzcrXJZA'


; Creating the object
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "https://post.craigslist.org", False)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")

; Performing the Request
$oHTTP.Send($sPD)

; Download the body response if any, and get the server status response code.
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

;If $oStatusCode <> 200 then
 MsgBox(4096, "Response code", $oStatusCode)
;EndIf

; Saves the body response regardless of the Response code
 $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists
 FileWrite($file, $oReceived)
 FileClose($file)

Thanks for the help guys - I plan to write this up and give it away (the current batch of CL renew apps are really friggin expensive).

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

On 2/16/2015 at 8:34 PM, baconismidog said:

Necroing:

I have this same issue. I'll try to explain it a different way. In the Craigslist account page, you can choose to 'renew' your posts every three days and then they'll get a fresh look from people. What we're trying to figure out is how to manage the POST command correctly. Here is the "inspect element" in Chrome for the "renew" hyperlink in the account page (I blanked out my account number with ##):

<form action="https://post.craigslist.org/manage/##########" method="POST"><input type="hidden" name="action" value="renew"><input type="hidden" name="crypt" value="U2FsdGVkX182NDQ0NjQ0NNYTGOKaJXDu34zUjkZCkVXDzwxZxSW1KA"><input type="submit" name="go" value="renew" class="managebtn"></form>

I know how to use string-in-string etc. to parse out the URL, actions, values, etc but what I can't get correct is the formatting for the POST command itself. I've tried including and exlcuding different parts (action, value, crypt, etc.). I get a 200 returned using the code below but it doesn't actually renew the post. I know the crypt values are different, they change regularly. 

; The data to be sent
$sPD = 'action=/manage/##########&name=action&value=renew&name=crypt&value=U2FsdGVkX182MzM0NjMzNOpDZW1SVeBDug_VuldCvGPgwoMzcrXJZA'


; Creating the object
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "https://post.craigslist.org", False)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")

; Performing the Request
$oHTTP.Send($sPD)

; Download the body response if any, and get the server status response code.
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

;If $oStatusCode <> 200 then
 MsgBox(4096, "Response code", $oStatusCode)
;EndIf

; Saves the body response regardless of the Response code
 $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists
 FileWrite($file, $oReceived)
 FileClose($file)

Thanks for the help guys - I plan to write this up and give it away (the current batch of CL renew apps are really friggin expensive).

 
 

Any luck with this? Trying to search the forums for something similar and this is the only post I found.

Edited by theak
spelling

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now