YBthebest
Members-
Posts
22 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
YBthebest's Achievements
Newbie (1/5)
0
Reputation
-
Hey ! Well, I really don't know how to use cURL that...complex... Do you have any examples?
-
using System.Net; using System.Collections.Specialized; ... ... /// <summary> /// Logging in to the OCR Terminal server /// </summary> /// <param name="username">Username (User must be ‘allowed’ to access the API)</param> /// <param name="password">Password</param> public static void login(string username, string password) { // URL of login page string uriString = "https://www.ocrterminal.com/api/user.cgi"; // User Agent string userAgent = "APIClient:" + username; // Create a new WebClient instance WebClient myWebClient = new WebClient(); myWebClient.Headers.Add(HttpRequestHeader.UserAgent, userAgent); // New NameValueCollection instance to hold custom parameters NameValueCollection myNameValueCollection = new NameValueCollection(); // Add necessary parameter/value pairs to the name/value container myNameValueCollection.Add("version", "1.0"); myNameValueCollection.Add("username", username); myNameValueCollection.Add("password", password); // Upload the NameValueCollection and get result byte[] responseArray = myWebClient.UploadValues(uriString, myNameValueCollection); // Decode and record the response string sLoginResult = Encoding.ASCII.GetString(responseArray); if (sLoginResult.IndexOf("User exists") > 0) { // Login was successful; process result // ... } else { // Login was unsuccessful; handle failure // ... } } I don't know if this can help, but this is the basis code. It is an API and they only give an example with C#, so I tried to ''translate'' it to PHP! maybe it can help! Thanks
-
Hey! Tried it, still the same error :/
-
Hello! This is my code: $postdata = http_build_query( array( 'version' => '1.0', 'username' => 'YBthebest', 'password' => 'MYPASSWORD' ) ); $username = 'YBthebest'; $opts = array( 'http'=>array( 'method'=>"POST", 'header'=>"User-Agent: APIClient:YBthebest\r\n" ) ); $context = stream_context_create($opts); $result = file_get_contents('https://ocrterminal.com/api/user.cgi', false, $context); Warning: file_get_contents(https://ocrterminal.com/api/user.cgi): failed to open stream: HTTP request failed! I get that error! What is failing? And yes, I need to send my username through User_agent !( // User Agent string userAgent = "APIClient:" + username;, taken from C example) Thanks !
-
Hello! I've got an issue! I'm trying to pass a very very long variable from JS to PHP through $_GET, but it seems too long for get. Is there any encryption function that works on both JS and PHP, so I can encrypt it in JS, send it though GET and decrypt it in PHP? Thanks !
-
Oh and if that link doesn't show any image... http://extreme-redeemer.com/math_captcha There you go
-
http://tutudragon3.info/maths_problem_image.php I see an image herE? $url = file_get_contents($url_image); echo $url; and $url is that url above Thanks
-
Hello! http://tutudragon3.info/maths_problem_image.php My problem is: I want to get the link to this image...but in .jpg, see what I mean? a file_get_contents of that page gets me some weird binary text and stuff. Is it possible? Thanks !
-
Nobody ? I actually really need this ! Thanks !
-
Hello! I want to know, do you know any FREE and WORKING PHP ocr? I really need it for an image. There are only numbers (between 1 and 50) and the singns +, - and *. And how can I use it/install it? Thank you so much!
-
[cURL]Login to a website and get the content of a page
YBthebest replied to YBthebest's topic in PHP Coding Help
Well if it can work for me...yes please ^^ I'm not sure at all, just need something :/ -
[cURL]Login to a website and get the content of a page
YBthebest replied to YBthebest's topic in PHP Coding Help
Is it rworking for you? How? It still is not working for me...and no that website does not check on the useragent...arghh Still waiting for an answer! Thank you very much, I love you guys -
[cURL]Login to a website and get the content of a page
YBthebest replied to YBthebest's topic in PHP Coding Help
Sorry for that! Well the problem it, it should show me the page with the auctions (prizes) but it shows me the 301 ( it's on Lockerz.com's server, you can see that at the bottom of the page ). Maybe the login is not OK? I don't really know cURL very well. Thank you so much... -
Hello! I would like to use cURL to login to the website: lockerz.com I have some code, but it doesn't seem to work: <?php // INIT CURL $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL, 'http://lockerz.com/auth/login'); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, 'email-email=EMAIL@hotmail.com&password-password=PASSWPRD'); // IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); # Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL # not to print out the results of its query. # Instead, it will return the results as a string return value # from curl_exec() instead of the usual true/false. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 1st REQUEST (FORM LOGIN) $store = curl_exec ($ch); // SET FILE TO DOWNLOAD curl_setopt($ch, CURLOPT_URL, 'http://lockerz.com/auction'); // EXECUTE 2nd REQUEST (FILE DOWNLOAD) $content = curl_exec ($ch); // CLOSE CURL curl_close ($ch); echo $content; ?> Thank you very much if you can help!
-
[cURL] Detect if there is a header(); on a page
YBthebest replied to YBthebest's topic in PHP Coding Help
Well you say it won't work but that is really weird...I've got a script that checks if there is some changement in a page, by checking if there is a <form on the page or if an image is still there ( the two methods work ) but they don't work when the page changes....and what they do, they add a header redirection on the first page and then it redirects to the second page, the important page. So my script doesn't detect any change it the page... And when I enter the URL of the second page, it detects the change... I'm lost! Did you understand anything xD?