hello guys! here's the thing: i need to write a PHP/C script that sends out XML-RPC for technorati, yahoo, and other blog sites. It's basically an automated blog pinger. Unfortunately i always get a "400 Bad Request" response from the hosts. I'm using curl with PHP (or) C. Here's my code in PHP:
[PHP]
$request = "<?xml version=\"1.0\"?><methodCall><methodName>weblogUpd ates.ping</methodName><params><param><value>".$_GET['blogurl']."</value></param><param><value>".$_GET['title']."</value></param></params></methodCall>";
$header[] = "User-Agent: Mozilla/5.001 (windows; U; NT4.0; en-us) Gecko/25250101";
$header[] = "Host: ".$_GET['hosturl'];
$header[] = "Content-type: text/xml";
$header[] = "Content-length: ".strlen($request) . "\r\n";
$header[] = $request;
echo "Sending ping to ".$_GET['hosturl'].$_GET['directory']."\n";
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $_GET['hosturl'].$_GET['directory']); # URL to post to
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); # return into a variable
curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); # custom headers, see above
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST,' POST '); # This POST is special, and uses its specified Content-type
curl_setopt( $ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
$result = curl_exec( $ch ); # run!
curl_close($ch);
echo $result;[/PHP]
Take note that I don't have the XML-RPC extension build with my PHP installation. Thanks for any help guys!
0 1319 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Haluk Durmus |
last post by:
Hello
I checked out openssl,mm,apr,apr-util,apache 2,curl,libxml and php
from cvs.
php couse an ERROR
I did the following steps:
|
by: Chris Fortune |
last post by:
# uname -a
Linux stargate.mxc-online.net 2.4.20-021stab022.2.777-smp #1 SMP Wed Jul 28
17:12:37
MSD 2004 i686 i686 i386 GNU/Linux
I recompiled PHP with mcrypt, openssl, and curl
phpinfo():...
|
by: Hans |
last post by:
Hi everybody,
I am desperately trying to log into my account at godaddy.com with PHP
and Curl and just cannot make it happen. Has anybody written a script
for this purpose?
Here is what I...
|
by: Shutdownrunner |
last post by:
I want to store result of curl in a variable, which means to store a
webpage in a variable in order to parse it later and get our some useful
information. But unfortunately I'm not too experienced...
|
by: nfhm2k |
last post by:
I've been trying to find a solution to this for quite some time now...
I even took a look at existing scripts...
Including this one......
|
by: zorro |
last post by:
Hello there,
I can't figure out why is it that when i use an array for my postfields
it doesn't work :
this works
curl_setopt($curl, CURLOPT_POSTFIELDS, "clown=bozo" );
this doesn't...
|
by: xerc |
last post by:
I am trying to create a generic function I can call to download all files from a single remote FTP directory -- using CURL. I want to multi-thread it, but need to get the single thread functionality...
|
by: Bucky |
last post by:
I want to make something where I can schedule future blog posts, and
it will automatically publish them to Xanga. I have a web host with
Linux, MySQL, PHP, cron, etc.
Type up blog post and...
|
by: rottmanj |
last post by:
I am re-writing my rets application in perl, and I have found a few modules that will help me on my way. One of them being WWW::Curl:easy.
During my testing, I have tested both system curl and...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |