Problem Parsing with cURL/PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
webmasterjunkie
Forum Newbie
Posts: 2
Joined: Tue Dec 13, 2005 2:36 pm

Problem Parsing with cURL/PHP

Post by webmasterjunkie »

Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


I am trying to get the following code to work, but am having some issues. The sessionid is storing in the socomcookies.txt file fine, but the session is still not authenticating.

Code: Select all

<?php

$user_socom_name = "";
$user_socom_pass = "";
$socom_stats_for = "INSANE.CASPER";

// login and store cookie data
$cookielocation = "socomcookies.txt";
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookielocation);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookielocation);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$url = "https://socom3html-prod.svo.pdonline.scea.com:10079/SOCOM3_HTML/account/Account_Login_Submit.jsp";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "userName=" . $user_socom_name . "&passWord=" . $user_socom_pass);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$result = curl_exec($ch);

// get actual data
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookielocation);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookielocation);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$url = "http://socom3html-prod.svo.pdonline.scea.com:10070/SOCOM3_HTML/stats/Stats_CareerSearch_Submit.jsp?userName=" . $socom_stats_for . "&gameMode=0";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$content = curl_exec($ch);
curl_close($ch);
$content = ereg_replace('"/', '"http://socom3html-prod.svo.pdonline.scea.com:10070/', $content);
echo $content;

?>
Let me know if you need any further information about this issue. I am hesitant on giving out the username and password, of course, but if you need it to get it figured out just let me know.

Any ideas?


Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

[b]EDIT:[/b] I apologize for not seeing that first, believe it or not, I did just leave that thread. I guess I did it backwards. Sincerest apologies.
Post Reply