FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How to automate 3rd party forms and upload data?





flatliner
Hi there

I am looking to automate a porcess of uploading images to a thrid party site via the thrid party web form. I am just wondering is this possible with PHP? I know I havent given much info, but I just looking to see could it be done in theory and what sorta functions would you be looking at?
Anybody done things like this before info would be most helpful?

Kind Regards
Ciaran Mc Cann
Jean-Luc
Hi,

You can upload images or any other files to a third party site, if it provides some way to do it. Cool

Not sure that I understood your question though.

Jean-Luc
rvec
Jean-Luc wrote:
Hi,

You can upload images or any other files to a third party site, if it provides some way to do it. Cool

Not sure that I understood your question though.

Jean-Luc

Good thinking Cool

If you mean you want to send an image to a website using your script instead of their forum, that's possible with curl (only works on server 2 atm, but it's in bondings' to do list for server 1).

You can send post/get data with a curl request and that way you could send an image to the webpage just like a form would do.
flatliner
rvec wrote:
Jean-Luc wrote:
Hi,

You can upload images or any other files to a third party site, if it provides some way to do it. Cool

Not sure that I understood your question though.

Jean-Luc

Good thinking Cool

If you mean you want to send an image to a website using your script instead of their forum, that's possible with curl (only works on server 2 atm, but it's in bondings' to do list for server 1).

You can send post/get data with a curl request and that way you could send an image to the webpage just like a form would do.


ah right I see, yes I was thinking curl alright wasnt completely sure about it tho. I never used it before so need at do some reseach I guess. Thanks guys
rvec
take a look at this page:
http://www.phpdig.net/ref/rn11re189.html

and this:
http://nl3.php.net/manual/en/function.curl-setopt.php

That's about all the info you can get
flatliner
Thanks for the help.
I have been messing around with curl for abit and a the moment I am trying to use it to login into the frih host forums here for practice. Although without much luck, here is my code, could anyone piont out whats wrong. Thanks Very Happy

Code:

<?php

error_reporting(E_ALL);


$url = "http://www.frihost.com/account/login.php";
$ch = curl_init();
$cookiefile = tempnam("/tmp", "cookies");


// set the target url
curl_setopt($ch, CURLOPT_URL,$url);

$agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
 
 
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
/* Disguise self as a browser app. */


// howmany parameter to post
curl_setopt($ch, CURLOPT_POST, 4);

// the parameter
curl_setopt($ch, CURLOPT_POSTFIELDS,"username=my_username_here&password=my_password_here&redirect=&login=Log+in");


curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
/* Read cookies from this file */
 
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
/* Save cookies to the same file too */


$result= curl_exec ($ch);
curl_close ($ch);

header("location:http://www.frihost.com/forums/profile.php?mode=editprofile")

?>
rvec
I made something to login to frihost and get the latest pm a while ago.

You don't need the agent setting, also no cookies are needed.

The header redirect will not work, it's not the same session and you're not using the same cookies.

I think you should take a better look at the login form, and allow redirects.
Related topics
Google Virused?
The best mobile Phone
Why I think iTunes is horrible
Can't he use those files?
What do you think about Mac OS X?
script-get 10 FRIH$
Bebo (The 'other' Myspace?)
Life is a game?
My Windows XP Cannot performed scandisk !?
Windows XP vs Mac OS X
CuteFTP Professional
Giving away computer and need help formatting it
Acer eRecovery
I LOVE MY PSP
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.